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

william

02/10/2021, 1:15 AM
is there an operator to plumb the output of one flow as the input to another (sharedflow)
z

Zach Klippenstein (he/him) [MOD]

02/10/2021, 1:18 AM
MutableSharedFlow
implements
FlowCollector
, so you can just do
upstreamFlow.collect(sharedFlow)
😮 1
👌 1
w

william

02/10/2021, 1:25 AM
cool, haven't seen that before. thanks
Following up here - it seems like that method is an internal coroutines api
z

Zach Klippenstein (he/him) [MOD]

02/10/2021, 3:46 PM
oh right, can you do
upstreamFlow.collect(sharedFlow::emit)
?
w

william

02/10/2021, 7:03 PM
yeah i can, was just curious if there was something that was a little cleaner. could create my own extension if i really wanted to. thanks!
z

Zach Klippenstein (he/him) [MOD]

02/10/2021, 7:11 PM
None that i’m aware of but happy to be proven wrong
3 Views