22 Channels
In the previous chapter, you used Flow to build streams that held your flight data as it changed over time. Flows allow you to store application state in an observable property and react to it as its value changes. But sometimes, it is not just two components that need to communicate with one another, but two coroutines.
If you want to send messages between two coroutines, Flow has some limits. Flows offer no way for a sender to know for sure that an emitted value was collected. And if there are multiple collectors, they can all get the same value. In some cases, you want to ensure that a value is received by exactly one coroutine, which you cannot easily accomplish with a flow.
To solve the problem of cross-coroutine ...
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