https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

Scott Kruse

06/11/2021, 7:01 PM
I was reading that
stateflow
never completes, so by this reasoning, we should never start collecting on a stateflow from within
suspend
function correct?
e

Erik

06/12/2021, 6:53 AM
If you want statements to run after the collect statement, then don't collect sequentially.
👆 1
Collect does rethrow an exception thrown while collecting the flow, so you could catch that and continue even after that, but that's likely breaking various good practices.
Although those exceptions likely happen in operations downstream of the state flow, so then you're not collecting the state flow, but a flow. 🤔
2 Views