dead.fish
02/07/2023, 11:57 AMephemient
02/07/2023, 12:54 PMShared flow never completes.
dead.fish
02/07/2023, 1:00 PMJames Yox
02/07/2023, 4:08 PMval coroutineScope = ... // some coroutine scope
val flow = otherFlow.shareIn(coroutineScope, SharingStarted.Eagerly)
coroutineScope.launch {
flow.collect { ... }
}
delay(3.seconds)
// This would cancel both sharing and collection since collect is in a child scope of coroutineScope.
coroutineScope.cancel()