https://kotlinlang.org logo
Title
v

Vinay Gaba

12/02/2021, 6:08 AM
I need to launch a coroutine in the
onDispose
of the DisposableEffect but I'm getting a
JobCancellationException
. This is probably due to the coroutine scope that I'm using (its the one that
rememberCoroutineScope
returns) that's not available anymore when I'm executing the
onDispose
block. Wondering how I can solve this?
z

Zach Klippenstein (he/him) [MOD]

12/02/2021, 5:22 PM
Why do you need to launch a coroutine?
v

Vinay Gaba

12/02/2021, 5:31 PM
Trying to emit an event to a StateFlow
z

Zach Klippenstein (he/him) [MOD]

12/02/2021, 5:32 PM
That never actually blocks right? Just use runBlocking
Or better yet, tryEmit
v

Vinay Gaba

12/02/2021, 7:16 PM
Doesn't work unfortunately.
z

Zach Klippenstein (he/him) [MOD]

12/03/2021, 6:14 PM
Can you elaborate?