Can StateFlow represent one off events?
# coroutines
r
Can StateFlow represent one off events?
🚫 1
z
It's not ideal if you're only emitting events (use
SharedFlow
for that). But if you're trying to express a one-off event in your state, you can use some kind of event ID to distinguish events over time.
s
You can finagle them to make that happen, but they are not ideal for this.
Until the SharedFlow become available, I wrapped a BroadcastChannel in a Flow to make my own shared-flow for now. It works, but the new SharedFlow is much more performant and not as ‘expensive’ (it doesn’t use a broadcastchannel, iirc).
✔️ 1
r
Cool thanks yall