I have 3 flows:
val flow1 = ... // emits values from the app start
val flow2 = ... // emits values from the app start
val flow3 = someBooleanFlow.flatMapLatest{ if(it) flowOf(42) else emptyFlow() } // emits when user registered
I need:
val state = flow1.flatMapConcat{ value1 ->
flow2.flatMapConcat{ value2 ->
flow3.flatMapConcat{ value3 -> when{ ... } // so value3 is not received if flow3 is empty,
// but I need its default value here to perform "when" logics
}
}
}
The question is how to take a default value in flatMapConcat when one of flows has not emitted?
The issue is also valid for combine