https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

alex.hart

07/11/2019, 4:36 PM
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

streetsofboston

07/11/2019, 4:40 PM
Maybe this can help you, a gist I wrote for this purpose: https://gist.github.com/streetsofboston/39c3f8c882c9891b35e0ebc3cd812381
👍 1
a

alex.hart

07/11/2019, 4:59 PM
Great! Thanks… Hopefully something like this will make it into the standard library.
s

streetsofboston

07/11/2019, 5:03 PM
This gist is a somewhat naive implementation. It works, but probably can be improved. 😀
a

alex.hart

07/11/2019, 5:36 PM
I feel like a ConflatedBroadcastChannel should do this for me already, but clearly doesn’t…
(give me something like a latest-value emitter)
z

Zach Klippenstein (he/him) [MOD]

07/11/2019, 5:38 PM
@alex.hart You should vote for and contribute your use case on this issue: https://github.com/Kotlin/kotlinx.coroutines/issues/1261
a

alex.hart

07/11/2019, 5:54 PM
👍
4 Views