16 Flows
This chapter covers
- Working with flows as a model for sequential streams of values
- Use cases for and differences between cold flows and hot flows
In the previous chapter, you have gotten to know coroutines and suspending functions as the basic abstraction used for concurrent programming in Kotlin. In this chapter, we will change our focus to a higher-level abstraction built on top of coroutines: flows, which allow you to work with multiple, sequential values over time while leveraging Kotlin’s concurrency machinery. In this chapter, we’ll discuss the ins and outs of flows. We’ll discuss the different types of flows and how to create, transform, and consume them.
16.1 Flows model sequential streams of values
As discussed in chapter ...
Get Kotlin in Action, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.