jeff
11/07/2019, 6:17 PMmyFlow
.flatMapMerge { item ->
flow { emit(suspendingFunctionThatMakesNetworkCall(item)) }
}
HOWEVER, Flow's flatMapMerge() has the following comment
Note that even though this operator looks very familiar, we discourage its usage in a regular application-specific flows.
Most likely, suspending operation in [map] operator will be sufficient and linear transformations are much easier to reason about.
I can't figure out how to do this with just a suspend map. Help?octylFractal
11/07/2019, 7:17 PM.transform { flow -> coroutineScope { flow.map { async { suspendingFunction(it) } }.buffer(N).emitAll() } }
might work out better / be more specificawait
and emit
themjeff
11/07/2019, 7:24 PM