Can a channel be easily converted to a flow?
# coroutines
a
Can a channel be easily converted to a flow?
a
yes but it depends on how you would like it to behave
a
Any docs?
a
.consumeAsFlow()
will return a flow that is only good for one `collect`; the channel will be automatically cancelled when the collect ends if the channel was not already closed by the sender
a
Oh so its still hot?
a
yes, it's still whatever the
SendChannel
was on the producer end, though as usual, the producer will suspend on
send
if the buffer is full and there is no waiting consumer
if you want to make a cold flow using a channel to produce into, you might be looking for the
channelFlow
builder
a
Oh awesome yes that’s exactly what I was looking for
Thanks!!
đź‘Ť 1