Alexandru Gheorghe
06/29/2024, 3:50 PMval myCall = coroutineReturningFlowCall()
but I don't collect
it, will the call to the database be made? Or only when I collect will the execution of the code be done?Rok Oblak
06/29/2024, 3:54 PMZach Klippenstein (he/him) [MOD]
06/29/2024, 5:20 PMfun createFlow(): Flow<Foo> {
val results = db.query()
return flow {
emitAll(results)
}
}
Vs
fun createFlow(): Flow<Foo> {
return flow {
val results = db.query()
emitAll(results)
}
}
Stylianos Gakis
06/29/2024, 5:27 PMsuspend
function.
If it's not suspending itself, and your .query() function is supsend itself you wouldn't even be able to write this in the first place, and boom, you caught this problem immediately.
Just gotta remember not to just auto-accept the IDE suggestion to make the function suspending 😅gildor
07/01/2024, 2:38 PMgildor
07/01/2024, 2:44 PM