Is there currently a way to implement some kind of...
# coroutines
d
Is there currently a way to implement some kind of
share
operator on
Flow
(at least in the meantime until it shows up in the library)? As in https://github.com/Kotlin/kotlinx.coroutines/issues/1261 ...
broadcastIn
and
asFlow
is probably hot... so a fast upstream might lead to lost emissions unless a buffer is properly configured...
The gist linked above implements a Flow variation of ConnectableObservable in Rx, which would allow for the
share
and
cache
operators.
d
You use this in production? Also, couldn't this be simplified, since anyways the actual implementation might be different when it comes around... I guess what I'm looking for is more of a simple quick-and-dirty-but-for-sure-works solution 😉. Although the Gist looks like a good idea 🙂, having a
ConnectableFlow
is much cleaner than returning a regular
Flow
...
s
Decisions have not yet been made by the JetBrains team. My issue (1086) and the related issue (1261) are still out standing.. not sure which one will be the one that is used….
I have not used it in production, but I have a pretty good test-suite around it.
d
Meanwhile, I think people are just going to fill their code with `buffer()`ed `broadcastIn`s returning `ReceiveChannel`s and `asFlow()`s 🤕... Thanks, I guess I'll take a look then.