sdeleuze
04/23/2019, 6:58 AMFlow
to a non-suspending function that returns Flow
. Is this the correct way to do that?
suspend fun suspendingFlow(): Flow<String> { ... }
fun nonSuspendingFlow() = flow {
suspendingFlow().collect {
emit(it)
}
}
Vsevolod Tolstopyatov [JB]
04/23/2019, 9:48 AMsuspendingFlow()
will be invoked on every collect
and it is probably not expected behavioursdeleuze
04/23/2019, 9:49 AMVsevolod Tolstopyatov [JB]
04/23/2019, 10:15 AMrunBlocking
sdeleuze
04/23/2019, 11:24 AMMono
and flatMapMany
sdeleuze
04/23/2019, 11:24 AMFlux
)