ursus
04/02/2026, 8:08 PMval pendingDeeplink = MutableStateFlowDeeplink?()
...
scope.launch {
pendingDeeplink
.filterNotNull()
.collect { deeplink ->
applyDeeplink(deeplink)
pendingDeeplink.value = null
}
}
is this a good or bad pattern? to null out a stateflow from the inside collector of said flow?
or maybe in general a collector of stateflow changing it?Youssef Shoaib [MOD]
04/02/2026, 8:16 PMursus
04/02/2026, 8:16 PMstreetsofboston
04/02/2026, 8:20 PMursus
04/02/2026, 8:20 PMursus
04/02/2026, 8:20 PMstreetsofboston
04/02/2026, 8:21 PMursus
04/02/2026, 8:21 PMstreetsofboston
04/02/2026, 8:22 PMpendingDeepLink
then the collect body will receive it and act.
Why do you need the value/event to remain until it has finished being processed?Youssef Shoaib [MOD]
04/02/2026, 8:22 PMursus
04/02/2026, 8:23 PMstreetsofboston
04/02/2026, 8:23 PMstreetsofboston
04/02/2026, 8:24 PMursus
04/02/2026, 8:24 PMstreetsofboston
04/02/2026, 8:24 PMstreetsofboston
04/02/2026, 8:25 PMursus
04/02/2026, 8:25 PMstreetsofboston
04/02/2026, 8:26 PMursus
04/02/2026, 8:27 PMursus
04/02/2026, 8:28 PMworkDone = true
doWork()streetsofboston
04/02/2026, 8:29 PMcollect is called. Is the scope cancelled upon orientation change and the collect ends and then scope.launch is executed again, or does the collect remain active upon an orientation change?streetsofboston
04/02/2026, 8:30 PMif your code inside collector is suspending, then it might not finish completely and youll pretend its fineyeah, that may be an issue.
ursus
04/02/2026, 8:30 PMsharedFlow
.collect {
delay(10.seconds)
work()
}
at second 5, you do orientation change, work will never executestreetsofboston
04/02/2026, 8:32 PMursus
04/02/2026, 8:32 PMstreetsofboston
04/02/2026, 8:32 PMscope