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

Zach Klippenstein (he/him) [MOD]

03/10/2020, 5:37 PM
There is so much demand for multicasting/sharing support in Flow. Libraries like dropbox/store have their own inline implementations. There are tons of gists of implementations posted on the various coroutine issues. I haven’t seen any libraries published on maven for this though. Has anyone factored any of these out into a library? We’re starting to consider moving from RxJava to Flow in some of our larger codebases and would like to use existing libraries for stuff like this instead of copy/pasting or writing our own implementation of stuff.
n

Nicholas Doglio

03/10/2020, 5:39 PM
Dropbox publishes multicast into it's own artifact. https://mvnrepository.com/artifact/com.dropbox.mobile.store/multicast
z

Zach Klippenstein (he/him) [MOD]

03/10/2020, 6:00 PM
oh i missed that, thanks!
👍 1
b

Brendan Weinstein

03/11/2020, 5:11 PM
I thought I needed a multicast operator and ended up just exposing a channel and calling
asFlow
whenever I need to multicast. Just need to be careful to cancel the channel when appropriate. What are the features from Rx multicasting that you need and for which purpose?
z

Zach Klippenstein (he/him) [MOD]

03/11/2020, 6:18 PM
A variety of things – typical use case is an object with its own lifetime that injects various service objects that vend `Flow`s, needs to combine those into its own
Flow
, and vend that. The object’s lifetime manages the upstream subscriptions, so we use `replay(1)`/`publish()` with manual
connect
a lot.
4 Views