Share
Asynchronous Data Streams with Kotlin Flow
Kotlin Flow is a declarative mechanism for working with asynchronous data streams that builds on top of Kotlin coroutines and structured concurrency. Kotlin Flows are doing the same revolution in simplicity for data streams that suspending functions did for data values.
In this talk we will discuss the challenges of working with asynchronous streams and how Kotlin Flows solve them. We will study the basics of Kotlin Flow design, see their typical usage patterns, peek behind the scenes and into some of the implementation details, checkout flow performance and see how they enable writing safe, reliable, and leak-free systems. We will also discuss how they relate to and incorporate ideas from reactive extensions and reactive streams, how they are similar and different, and how they can be used together.
Roman Elizarov
Transcript
161 slides
-
Copenhagen Denmark ASYNCHRONOUS DATA STREAMS WITH KOTLIN FLOW ROMAN ELIZAROV
@relizarov Copenhagen Denmark -
Callback hell before fun requestTokenAsync(): Promise<Token> { … } fun
createPostAsync(token: Token, item: Item): Promise<Post> … fun processPost(post: Post) { … } fun postItem(item: Item) { requestTokenAsync() .thenCompose { token -> createPostAsync(token, item) } .thenAccept { post -> processPost(post) } } -
Direct style with Kotlin Corou6nes suspend fun requestToken(): Token {
… } suspend fun createPost(token: Token, item: Item): Post { … } fun processPost(post: Post) { … } suspend fun postItem(item: Item) { val token = requestToken() val post = createPost(token, item) processPost(post) } Like regular code -
Direct style with Kotlin Coroutines suspend fun requestToken(): Token {
… } suspend fun createPost(token: Token, item: Item): Post { … } fun processPost(post: Post) { … } suspend fun postItem(item: Item) { val token = requestToken() val post = createPost(token, item) processPost(post) } -
Asynchronous yet sequen6al suspend fun requestToken(): Token { … }
suspend fun createPost(token: Token, item: Item): Post { … } fun processPost(post: Post) { … } suspend fun postItem(item: Item) { val token = requestToken() val post = createPost(token, item) processPost(post) } -
Asynchronous yet sequential suspend fun requestToken(): Token { … }
suspend fun createPost(token: Token, item: Item): Post { … } fun processPost(post: Post) { … } suspend fun postItem(item: Item) { val token = requestToken() val post = createPost(token, item) processPost(post) } -
Asynchronous yet sequential suspend fun requestToken(): Token { … }
suspend fun createPost(token: Token, item: Item): Post { … } fun processPost(post: Post) { … } suspend fun postItem(item: Item) { val token = requestToken() val post = createPost(token, item) processPost(post) } -
suspend fun foo(): List<Response> = buildList { add(compute("A")) add(compute("B")) add(compute("C"))
} fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
suspend fun foo(): List<Response> = buildList { add(compute("A")) add(compute("B")) add(compute("C"))
} fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
suspend fun foo(): List<Response> = buildList { add(compute("A")) add(compute("B")) add(compute("C"))
} fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
main() foo() suspend fun foo(): List<Response> = buildList { add(compute("A"))
add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
main() foo() suspend fun foo(): List<Response> = buildList { add(compute("A"))
add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
main() foo() A suspend fun foo(): List<Response> = buildList {
add(compute("A")) add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
main() foo() suspend fun foo(): List<Response> = buildList { add(compute("A"))
add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } B A -
main() foo() suspend fun foo(): List<Response> = buildList { add(compute("A"))
add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } C B A -
main() foo() suspend fun foo(): List<Response> = buildList { add(compute("A"))
add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } List<Response> C B A -
main() foo() suspend fun foo(): List<Response> = buildList { add(compute("A"))
add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } List<Response> C B A -
main() foo() List<Response> A B C B C A suspend
fun foo(): List<Response> = buildList { add(compute("A")) add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
main() foo() List<Response> A B C B C A suspend
fun foo(): List<Response> = buildList { add(compute("A")) add(compute("B")) add(compute("C")) } fun main() = runBlocking { val list = foo() for (x in list) println(x) } -
fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) }
fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) }
fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) }
fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B"))
send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B"))
send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() Channel<R> fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A"))
send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() Channel<R> fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A"))
send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() Channel<R> fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A"))
send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send Channel<R> A fun CoroutineScope.foo(): ReceiveChannel<Response> = produce
{ send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send Channel<R> A A fun CoroutineScope.foo(): ReceiveChannel<Response> =
produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send Channel<R> A A B fun CoroutineScope.foo():
ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send Channel<R> A B A B fun
CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send send Channel<R> A B A B
C fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send send Channel<R> A B C A
B C fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send send Channel<R> A B C A
B C fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send send Channel<R> A B C A
B C fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
main() foo() send send send Channel<R> A B C A
B C ❌ fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() for (x in channel) println(x) } -
fun main() = runBlocking { val channel = foo() for
(x in channel) println(x) } Channel is hot -
Channel is hot fun main() = runBlocking { val channel
= foo() // for (x in channel) println(x) } -
main() foo() Channel fun CoroutineScope.foo(): ReceiveChannel<Response> = produce { send(compute("A"))
send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() // for (x in channel) println(x) } -
main() foo() send Channel A fun CoroutineScope.foo(): ReceiveChannel<Response> = produce
{ send(compute("A")) send(compute("B")) send(compute("C")) } fun main() = runBlocking { val channel = foo() // for (x in channel) println(x) } -
fun main() = runBlocking { val flow = foo() flow.collect
{ x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
fun main() = runBlocking { val flow = foo() flow.collect
{ x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
fun main() = runBlocking { val flow = foo() flow.collect
{ x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() fun main() = runBlocking { val flow =
foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() fun main() = runBlocking { val flow =
foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() Flow<R> fun main() = runBlocking { val flow
= foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() Flow<R> fun main() = runBlocking { val flow
= foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() collect Flow<R> fun main() = runBlocking { val
flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit collect A Flow<R> fun main() = runBlocking
{ val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit A collect A Flow<R> fun main() =
runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit A collect A Flow<R> fun main() =
runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit A collect A B Flow<R> fun
main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit A B collect A B Flow<R>
fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit A B collect A B Flow<R>
fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit emit A B collect A B
C Flow<R> fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit emit A B C collect A
B C Flow<R> fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit emit A B C collect A
B C Flow<R> fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit emit A B C collect A
B C ❌ Flow<R> fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
main() foo() emit emit emit A B C collect A
B C ❌ Flow<R> fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } fun foo(): Flow<Response> = flow { emit(compute("A")) emit(compute("B")) emit(compute("C")) } -
fun main() = runBlocking { val flow = foo() flow.collect
{ x -> println(x) } } Flow is cold ❄ -
fun main() = runBlocking { val flow = foo() //
flow.collect { x -> println(x) } } Flow is cold ❄ -
Flow is declarative fun foo(): Flow<Response> = flow { emit(compute("A"))
emit(compute("B")) emit(compute("C")) } Declaration -
fun strings(): Flow<String> = flow { … } fun foo():
Flow<Response> = strings().map { name -> compute(name) } -
fun strings(): Flow<String> = flow { … } fun foo():
Flow<Response> = strings().map { name -> compute(name) } -
fun strings(): Flow<String> = flow { … } fun foo():
Flow<Response> = strings().map { name -> compute(name) } -
fun strings(): Flow<String> = flow { … } fun foo():
Flow<Response> = strings().map { name -> compute(name) } Operators -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } Operators -
Flow vs List fun foo(): Flow<Response> = flowOf("A", "B", "C").map
{ name -> compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } Defined – Declarative Runs – Impera:ve suspend fun <T> Flow<T>.collect(…) Runs the flow Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } Defined – Declara:ve Runs – Imperative suspend fun <T> Flow<T>.toList(): List<T> Runs the flow Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } Flow vs List Execu6on order -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } B C A Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } B C A map Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } B C A B’ C’ A’ map Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } B C A B’ C’ A’ map A A’ Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } B C A B’ C’ A’ map A B’ A’ B Flow vs List -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } suspend fun foo(): List<Response> = listOf("A", "B", "C").map { name -> compute(name) } B C A B’ C’ A’ map A B’ C’ A’ B C Flow vs List React on emi2ed values -
fun <T : Any> Flow<T>.asPublisher(): Publisher<T> fun <T : Any>
Publisher<T>.asFlow(): Flow<T> org.reactivestreams Publisher<T> kotlinx.coroutines.flow Flow<T> -
A A’ mapper fun map(mapper: (T) -> R): Flowable<R> fun
flatMapSingle(mapper: (T) -> SingleSource<R>): Flowable<R> Synchronous Asynchronous Flowable<T> -
A A’ mapper fun map(mapper: (T) -> R): Flowable<R> fun
flatMapSingle(mapper: (T) -> SingleSource<R>): Flowable<R> fun filter(predicate: (T) -> Boolean): Flowable<T> A A predicate Synchronous Asynchronous Synchronous Asynchronous Flowable<T> -
A A’ transform fun map(transform: suspend (T) -> R): Flow<R>
Flow<T> fun filter(predicate: suspend (T) -> Boolean): Flow<T> A predicate A -
Operator avoidance startWith(value) onStart { emit(value) } delaySubscription(time) onStart {
delay(time) } startWith(flow) onStart { emitAll(flow) } delayEach(time) onEach { delay(time) } onErrorReturn(value) catch { emit(value) } onErrorResume(flow) catch { emitAll(flow) } generate(…) flow { … } Composable -
interface Flow<out T> { suspend fun collect(collector: FlowCollector<T>) } interface
FlowCollector<in T> { suspend fun emit(value: T) } -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect 1 -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect 1 -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect 1 λ -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect 1 λ -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect emit λ 1 2 λ -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect emit λ println 1 2 3 λ -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") } collect λ emit λ println 1 2 3 ^ 4 ^ 5 -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") emit("B") } collect λ emit λ println emit println -
flow.collect { value -> println(value) } val flow = flow
{ emit("A") delay(100) emit("B") } collect λ emit λ println emit println Asynchronous emi@er -
flow.collect { value -> delay(100) println(value) } val flow =
flow { emit("A") delay(100) emit("B") } collect λ emit λ println emit println Backpressure -
Kotlin Flow Plays Scrabble • Benchmark originally developed by José
Paumard • Implemented for RxJava by David Karnok -
Kotlin Flow Plays Scrabble • Benchmark originally developed by José
Paumard • Implemented for RxJava by David Karnok SequencePlaysScrabble 9.824 ± 0.190 ms/op https://github.com/Kotlin/kotlinx.coroutines/tree/develop/benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/README.md -
Kotlin Flow Plays Scrabble • Benchmark originally developed by José
Paumard • Implemented for RxJava by David Karnok SequencePlaysScrabble 9.824 ± 0.190 ms/op RxJava2PlaysScrabbleOpt 23.653 ± 0.379 ms/op https://github.com/Kotlin/kotlinx.coroutines/tree/develop/benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/README.md -
Kotlin Flow Plays Scrabble • Benchmark originally developed by José
Paumard • Implemented for RxJava by David Karnok SequencePlaysScrabble 9.824 ± 0.190 ms/op RxJava2PlaysScrabbleOpt 23.653 ± 0.379 ms/op FlowPlaysScrabbleOpt 13.958 ± 0.278 ms/op https://github.com/Kotlin/kotlinx.coroutines/tree/develop/benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/README.md -
main() emit emit emit A B C collect A B
C ❌ 100 ms 100 ms 100 ms 100 ms 100 ms 100 ms 100 ms 700 ms Single corouDne -
flow.buffer().collect { … } main() emit emit emit A B
C collect A B C ❌ 100 ms 100 ms 100 ms 100 ms 400 ms 100 ms 100 ms 100 ms -
flow.buffer().collect { … } main() emit emit emit A B
C collect A B C Separate corouDne -
flow.buffer().collect { … } main() send send send A B
C collect A B C ❌ Channel Declarative & safe -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } Where does it execute? -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } .flowOn(Dispatchers.Default) fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } Executes in background -
fun foo(): Flow<Response> = flowOf("A", "B", "C").map { name ->
compute(name) } .flowOn(Dispatchers.Default) Executes in collector’s context fun main() = runBlocking { val flow = foo() flow.collect { x -> println(x) } } Context preservation -
fun events(): Flow<Event> scope.launch { events().collect { event -> updateUI(event)
} } “Subscribe” to events -
fun events(): Flow<Event> events() .onEach { event -> updateUI(event) }
.launchIn(scope) “Subscribe” to events -
fun events(): Flow<Event> events() .onEach { event -> updateUI(event) }
.launchIn(scope) “Subscribe” to events -
Observable • ………. • ….. • …….. subscribe observable.subscribe {
event -> updateUI(event) } -
Observable • ………. • ….. • …….. subscribe SubscripIon observable.subscribe
{ event -> updateUI(event) } -
Observable • ………. • ….. • …….. subscribe SubscripIon val
composite = CompositeDisposable() composite.add(observable.subscribe { event -> updateUI(event) }) -
Observable • ………. • ….. • …….. subscribe SubscripIon val
composite = CompositeDisposable() composite.add(observable.subscribe { event -> updateUI(event) }) composite.clear() -
Flow • ………. • ….. • …….. launch Job CorouIneScope
Structured Concurrency -
Flow • ………. • ….. • …….. launch Job events()
.onEach { event -> updateUI(event) } .launchIn(scope) -
Flow • ………. • ….. • …….. launch Job val
scope = MainScope() events() .onEach { event -> updateUI(event) } .launchIn(scope) -
Flow • ………. • ….. • …….. launch Job val
scope = MainScope() events() .onEach { event -> updateUI(event) } .launchIn(scope) scope.cancel() -
Flow • ………. • ….. • …….. launch Job val
scope = MainScope() events() .onEach { event -> updateUI(event) } .launchIn(scope) scope.cancel() -
LiveData • ………. • ….. • …….. observe data.observe(livecycleOwner) {
event -> updateUI(event) } -
Status & Roadmap Flow is stable in kotlinx.corouInes version 1.3.0
Future improvements ØOut-of-the box support for UI models (StateFlow / EventFlow) ØSharing / caching flows ØConcurrency / parallelism operators ØChunking / windowing operators Want more? Give us your feedback h2ps://github.com/Kotlin/kotlinx.corouInes/issues -
Learn more vKotlin Flow by example guide https://kotlinlang.org/docs/reference/coroutines/flow.html vAPI docs
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/ vStories in my blog https://medium.com/@elizarov