Hy folks, I'm using `receiveAsFlow` to transform a...
# coroutines
t
Hy folks, I'm using
receiveAsFlow
to transform a Channel in Flow. After cancel the CoroutineScope where I'm collecting the Channel values it seems not have closed the Channel. Can be codes like below create leaks without call
close()
? Should I add a call to
invokeOnCompletion
to make sure that close my Channel as:
Copy code
invokeOnCompletion {
            channel.close()
        }
t
Sounds like you want
consumeAsFlow
to have it close the upstream
Channel
when you stop collecting.
👍 2