I receive some events from the backend. I want to ...
# coroutines
l
I receive some events from the backend. I want to internally pass the events as a
Flow
or through a
Channel
. After the last event I want to send a "complete" signal. Is there something like this in
Flow
?
s
Does the “complete” signal need to contain any data? A channel terminates normally if you
close()
it, but you can’t include any data in the close signal 😞 (except by using exceptions, which is gross)
l
Oh, that would be enough - I just need to signal that the stream completed normally (i.e. has not been canceled). Thanks for your help!
h
You could also use a
channelFlow
if you like the flow API more
l
I need a hot flow, so I will probably send the events to a
Channel
and maybe receive it as
Flow