Arjan van Wieringen
06/27/2022, 2:16 PMJoffrey
06/27/2022, 2:18 PMrunCurrent
or advanceUntilIdle
to ensure your coroutines have progressed enoughArjan van Wieringen
06/27/2022, 2:25 PMJoffrey
06/27/2022, 2:28 PMlaunchIn
, the job is likely active from the start, but that doesn't mean it reached the suspension on the collect
- so it would be of no use to you to wait for this event even if you couldlaunch(start = CoroutineStart.UNDISPATCHED) { flow.collect { ... } }
instead of using launchIn
. That would ensure the first suspension point is reachedArjan van Wieringen
06/27/2022, 2:30 PMJoffrey
06/27/2022, 2:33 PMArjan van Wieringen
06/27/2022, 2:38 PMAdam Powell
06/27/2022, 2:50 PMNick Allen
06/27/2022, 4:04 PMonSubscription
does not help here. It waits for the subscription on the SharedFlow
to be setup so if an event is emitted, it won't be missed but it does not wait for the suspension point on collect
so the “shared" coroutine may not have done anything.