I have Flow1 returns data that Flow2 needs, if Flo...
# getting-started
b
I have Flow1 returns data that Flow2 needs, if Flow1 fails then I want Flow2 to basically rewrap that error and emit it. If Flow1 is successful I want Flow2 to return a room DB Flow. flow1.combine(flow2), but obviously there is no way to pass the value from flow1 to flow2 I tried flow1.map{x flow2Fun(x) } where flow2Fun returns a Flow<A>, but the map gives a result of Flow<Flow<A>>. What is the best way to do this, since flow1 can change during life of app
f
I suggest to use
.transform
Copy code
flow1.transform { result1 ->
    emitAll(flow2(result1))
}
you can either use emitAll to re-emit all results from flow2 or do a conditional emit based on flow1 and flow2 result