https://kotlinlang.org logo
#coroutines
Title
# coroutines
t

Thiago

02/24/2021, 3:35 PM
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

travis

02/24/2021, 4:49 PM
Sounds like you want
consumeAsFlow
to have it close the upstream
Channel
when you stop collecting.
👍 2
5 Views