Coroutines & Flow
This section covers Kotlin Coroutines and Flow in Android: asynchronous work, structured concurrency, cancellation, streams, hot state, event delivery, and lifecycle-aware collection.
For a practical learning path, start with coroutine basics and scope ownership. Continue with Flow fundamentals and operators, then compare channels with StateFlow and SharedFlow. Finish with lifecycle-aware collection before connecting streams to Android UI.
Coroutine foundations
- Coroutines Basics - suspending work, concurrency, dispatchers, builders, and switching execution context.
- Coroutine Scopes & Cancellation - scope ownership, structured concurrency, job hierarchies, supervision, cleanup, and cooperative cancellation.
Streams and communication
- Flow Basics - cold streams, collection, context, cancellation, and error boundaries.
- Flow Operators - transformation, flattening, combining, buffering, retry, and terminal operations.
- Channels - send and receive semantics, buffering, closing, cancellation, and point-to-point communication.
- StateFlow & SharedFlow - hot streams, observable state, broadcasts, replay,
stateIn, andshareIn.
Android lifecycle integration
- Lifecycle-aware Collection -
repeatOnLifecycle,collectAsStateWithLifecycle, parallel collectors, and Compose effect boundaries.