In general completion event is CancellationException propagated as error, but how you do it depends on flow implementation
StateFlow implementation is not cancellable, shared flow can be cancellable, depending on implementation
c
Casey Brooks
04/06/2022, 3:32 PM
.takeWhile { }
or
.transformWhile { }
is useful for exactly this purpose, emitting values downstream while some condition remains true. You can use it to check that the upstream values are not the “completion token”.
g
gildor
04/06/2022, 3:34 PM
Yep, the only thing you cannot expose StateFlow, those extensions create Flow