What actually cancels a Flow? The act of stopping to collect it?
m
Marc Knaup
02/05/2021, 12:59 PM
afaik a Flow ends if either
• the Flow is complete (no more elements, or exception thrown - e.g. when canceled).
• the Flow collector has thrown an exception - e.g. when cancelled.
Marc Knaup
02/05/2021, 12:59 PM
takeWhile
and alike throw a
CancellationException
internally
f
Florian
02/05/2021, 1:03 PM
thank you
Florian
02/05/2021, 1:03 PM
so when I collect in a coroutine scope and that scope is cancelled, the Flow is definitely cancelled