Vivek Sharma
02/09/2021, 10:05 AM2 flows
and I want to observe their changes with flatMapLatest
, if either of them emit new value, I want to trigger some action, but how can I observe on 2 flows
, should I combine them ? how can I do sowasyl
02/09/2021, 10:10 AMmerge(flow1, flow2)
gildor
02/09/2021, 10:15 AMVivek Sharma
02/09/2021, 10:32 AMflatMapLatest
and inside lambda, I was receiving flow and flatMapLatest
was returning that flow
, but when I use combine
, this will emit Flow<Flow<>>
, so is there a way to achieve like flatMapLatestgildor
02/09/2021, 11:08 AMgildor
02/09/2021, 11:14 AMVivek Sharma
02/09/2021, 11:16 AMval someStateFlow = flow1.combine(flow2) { a, b ->
recievingFlowFromRepository().first()
}.stateIn(...)
I used first() as I think I will not receive more values (usecase here is getting data from network) and then let the combine convert it to flowokarm
02/09/2021, 2:48 PM