james
06/09/2021, 4:01 AMIan Lake
06/09/2021, 5:00 AMshareIn()
or stateIn
, then it sounds like you should be using SharingStated.WhileSubscribed()
, which would automatically stop the upstream collecting when your collectAsState()
/ collect
within a LaunchedEffect
cancels (i.e., you move to another screen). There's some more discussion around how that works at https://developer.android.com/kotlin/flow/stateflow-and-sharedflowjames
06/09/2021, 5:07 AMcb
06/09/2021, 6:49 AMjames
06/09/2021, 11:29 AM