What Is a Channel?
Learn about Channel and its interface..
We'll cover the following
Many of us are eager to finally hear about Flow
, also known as coroutines’ reactive streams. In the following chapters, we will learn about Channel
and Flow
, both of which are valuable tools worth knowing about. We’ll start with Channel
, as it’s a bit more of a basic concept, then we’ll get deeply into learning about Flow
.
Channel
The Channel
API was added as an inter-coroutine communication primitive. Many imagine a channel as a pipe, but we prefer a different metaphor, such as exchanging books at a public library. One person needs to bring a book back so it can be put on the shelf and another person can find it. This is very similar to how Channel
from kotlinx.coroutines
works.
Get hands-on with 1400+ tech skills courses.