Lukas Lechner
10/03/2022, 8:52 AMcollect{}
operator? The docs say that it should be possible to call cancel()
, but that doesn’t seem to work….simon.vergauwen
10/03/2022, 8:56 AMcancel()
coming from in that case? 🤔
throw CancellationException
is the first thing that comes to mind, which then probably ends up in a launch
or launchIn
and then the behavior depend on the surrounding CoroutineScope
impl.
What is your use-case for this?Lukas Lechner
10/03/2022, 9:03 AMrunBlocking{}
, and there we have coroutineScope
as receiver, on which cancel can be called.Lukas Lechner
10/03/2022, 9:03 AMLukas Lechner
10/03/2022, 9:05 AMCancellationException
is thrown 🤔 Aren’t CancellationExceptions
special kind of exceptions that don’t lead to crashes?Robert Williams
10/03/2022, 9:10 AMJhonatan Sabadi
10/04/2022, 11:17 AMsimon.vergauwen
10/04/2022, 11:19 AMcancellable
it will inject ensureActive()
in between calls to emit
.
https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/cancellable.html