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

Jan Skrasek

08/13/2019, 1:42 PM
I'm using these extensions to convert Flow from and to LiveData. After updating to coroutines 1.3 (RC2) this seems doesn't work as intented. Is it bug or am I missing something?
What's happening now is that invokeOnClose is immediately called.
l

louiscad

08/13/2019, 1:46 PM
@Jan Skrasek You need to replace
invokeOnClose { }
by
awaitClose { }
.
j

Jan Skrasek

08/13/2019, 1:53 PM
Thanks, it's working now! I'm thinking how exactly it works. 🤔
Oh, i see it. Channel suspends until channel is closed from outside. But if it didn't suspend, channelFlow would end and close itself. I'm I right?
g

gildor

08/13/2019, 2:01 PM
Yes
3 Views