If I'm in a `callbackFlow` what's the best way to ...
# coroutines
e
If I'm in a
callbackFlow
what's the best way to determine if I should still emit?
isActive
or
!isClosedForSend
(or both)?
b
just remove your callback in
awaitClose { }
. With new channel api (coroutines 1.5+) it's safe to call `trySend`/`trySendBlocking` anyway.
e
I think I've encountered race conditions in the past where my listener was still invoked (maybe a concurrent invocation with
awaitClose
firing or something like that), although I'm not 100% sure I didn't start doing this following the pattern that I use with
suspendCancellableCoroutine