Could someone give me a hint on how to do multicas...
# coroutines
a
Could someone give me a hint on how to do multicasting with flow? (Multiple subscribers, possibly after flow has finished emitting items, like what
cache
or
replay
would do from Rx)
s
Maybe this can help you, a gist I wrote for this purpose: https://gist.github.com/streetsofboston/39c3f8c882c9891b35e0ebc3cd812381
👍 1
a
Great! Thanks… Hopefully something like this will make it into the standard library.
s
This gist is a somewhat naive implementation. It works, but probably can be improved. 😀
a
I feel like a ConflatedBroadcastChannel should do this for me already, but clearly doesn’t…
(give me something like a latest-value emitter)
z
@alex.hart You should vote for and contribute your use case on this issue: https://github.com/Kotlin/kotlinx.coroutines/issues/1261
a
👍