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

Andrew Gazelka

06/19/2019, 9:30 PM
is there a more idiomatic way to do
val hotFlow = baseFlow.conflate().broadcastIn(this).asFlow()
?
Copy code
@FlowPreview
@ExperimentalCoroutinesApi
fun main() = runBlocking<Unit> {
    val baseFlow = (1..10).asFlow().delayEach(1_000)
    val hotFlow = baseFlow.conflate().broadcastIn(this).asFlow()
    launch {
        hotFlow.collect {
            println("A: $it")
        }
    }

    delay(5_000)
    launch {
        hotFlow.collect {
            println("B: $it")
        }
    }
}
l

louiscad

06/19/2019, 9:55 PM
Not yet AFAIK.
2 Views