Kotlin Shared Flow with uncertain amount of replay value

71 views Asked by At

I have a shared flow and a collector that will attach to it and collect a couple of seconds after the flow will emit values. I need the collector to be able to get values emitted before it had a chance to attach. I know Shared Flow has "replay" that you can set for this scenario, but what if I dont know how many values I will miss, should I just set replay = Int.MAX_VALUE and leave it like that or is there a better way to do it ?

0

There are 0 answers