Is there a better way to “launch flow collection b...
# flow
m
Is there a better way to “launch flow collection but suspend until the collection is ready”? Without this workaround (i.e.
.onEach { … }.launchIn(…)
) elements can be missed if they’re emitted shortly after this.
e
Copy code
launch(start = CoroutineStart.UNDISPATCHED) {
    collect { action(it) }
}
m
That does something very different 🤔 It delays the start of the collection instead the start of the emission.
e
the
launch
doesn't return until
collect
suspends, after which it is safe to start emitting. is that not what you want to wait for?
c
What is the scope of that?