<@U2E974ELT> In the article you write that one sho...
# coroutines
v
@elizarov In the article you write that one should not use
withContext
inside a
flow{}
, basically. Can there be a realistic situation when such use is permitted? Maybe if
emit
is outside of
withContext
, or there are several `nested
withContext
that work in a way that protect the caller's context?
e
You can use
withContext
, but cannot
emit
from a different context.
p
Also be careful because if you use
withContext
, you might receive elements after the job was cancelled, even if you're cancelling on the same thread: https://github.com/Kotlin/kotlinx.coroutines/issues/1177