Hello. I have a flow created with
channelFlow
, and a simple flow created with
flowOf
. I want to concatenate them so I do
val concatened = chanFlow.onCompletion { if(it==null) emitAll(simpleFlow) }
. Then the flow is "launched"
GlobalScope.launch { concatened.collect { ... } }
. When I cancel the resulting job, the chanFlow stop correctly and throw
CancellationException
, but the second flow values are still collected. The
throwable
in
onCompletion
is null. What is the correct way to handle this ?