I have now finally completed my quest of sharing a...
# coroutines
d
I have now finally completed my quest of sharing a
Flow
between n subscribers where all n must definitely receive all elements (but I don't want to keep a replay cache for all of the elements...). My solution works, but it seems strangely complex for a task that seems very common: First I have a custom
SharingStarted
implementation that ensures that the shared flow does not start collecting until all subscribers have either subscribed or have failed: https://pastebin.com/g6hsUQxg Then it is used like this (sharing
data
between all
delegates
): https://pastebin.com/TzT9NnTy Is this really the best solution? 🤔