https://kotlinlang.org logo
Title
a

Amanjeet Singh

06/17/2019, 1:01 PM
Is there something analogous to observable.create for Coroutines I found a way through channels just want to dug upon any different ways?
g

gildor

06/17/2019, 2:18 PM
For which abstraction? Flow?
z

Zach Klippenstein (he/him) [MOD]

06/18/2019, 2:41 AM
The closest analog is
flow { }
and
channelFlow { }
, which create cold `Flow`s. For channels, there’s
CoroutineScope.produce { }
(although channels are hot, so that’s a bit different than
Observable.create
).
Use
flow
if you’re emitting from a single context, use
channelFlow
if you need to emit from other coroutines, or from a regular callback.
a

Amanjeet Singh

06/18/2019, 6:38 AM
Hey @Zach Klippenstein (he/him) [MOD] thanks will look into this 🙂