benkuly
09/29/2021, 6:12 AMflow
and stateIn
or does it has unpredictable side effects. It does not feel right to pass this
into stateIn
. Does doSomething()
ever return or will it suspend infinite, because the scope is used by stateIn
?
suspend fun doSomeThing() = coroutineScope {
val someState = someFlow.stateIn(this)
...
}
louiscad
09/29/2021, 7:50 AMmyanmarking
10/01/2021, 11:10 AMlouiscad
10/01/2021, 12:18 PMcoroutineScope
lambda, doesn't cancel the scope. What happens instead is it waits for all children to complete, which will never happen.benkuly
10/01/2021, 12:50 PMdoSomething()
is called?louiscad
10/01/2021, 12:51 PMbenkuly
10/01/2021, 1:03 PMcurrentCoroutineContext()
, so it will be cancelled when the parent from currentCoroutineContext()
is cancelled?
Or is this all irrelevant, because the garbage collector cancels the StateFlow
when there is no reference to it anymore?louiscad
10/01/2021, 1:12 PM