Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
For the More Curious: Coroutines, Flow, and Compose
Coda Pizza is a small application to get your feet wet with Compose. But what about bigger apps that need to store data or access a web service?
The Kotlin coroutines you met in Chapter 12 are a great fit for Compose, thanks to a few APIs that translate between the declarative and asynchronous worlds. In fact, Compose itself uses coroutines in a few of its APIs. You can see an example of one of these APIs in the next section (the section called For the More Curious: Scrolling State).
In Chapter 12, you also explored using StateFlow to manage UI state. At a high level, StateFlow and Compose’s State classes do roughly the same thing: They emit a sequence of values over time and ...
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