I want MutableSharedFlow to keep the values 1, 2 i...
# flow
n
I want MutableSharedFlow to keep the values 1, 2 in it’s buffer if no one is collecting it.
g
It will not work, you need channel for this SharedFlow allows only “repeat” behaviour, when you specify how many items will be sent to new subscriber
t
Are you looking for replayCache?
g
replayCache is the same as replay param in MutableSharedFlow
n
What I want is for it to accumulate the data till someone first subscribes. Not subsequent subscribes. So replay is out of the picture
g
yep, this how channel with buffer works
n
Not how I want it to work. I want all the subsequent subscribers to get all the events
g
If you need multicast, use BroadcastChannel
n
But then it doesn’t keep the buffer. I tried passing capacity = Channel.UNLIMITED. It crashes