Channels and flow
Channels are a newer feature in Kotlin that can transfer streams of values similar to how an Observable stream might work in RxJava. Using Channels, it's possible to create theoretically infinite streams of data and process that data asynchronously in an efficient manner. Consumers can then operate on the results of the asynchronous operations in much the same way that an Observable chain is subscribed to.
Flow is also a new feature in Kotlin, built on top of coroutines, and designed to enable cold asynchronous streams of data. This is similar to channels, and yet there is an important distinction. Flow will only emit values once something is listening for those values, and Flow doesn't necessarily solve any concurrency ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access