What problem does it solve?
This skill helps Kotlin developers select and use Flow, StateFlow, SharedFlow, and Channel correctly across Android and Kotlin Multiplatform projects to ensure correct lifecycle handling, type safety, and clean architecture.
Core Features & Use Cases
- Guidance on choosing Flow types (Flow, StateFlow, SharedFlow, Channel) for data streams, UI state, and events.
- Lifecycle-safe collection patterns for Compose and non-Compose apps, including repeatOnLifecycle and collectAsStateWithLifecycle equivalents.
- Channel migration guidance with risk assessment and trade-offs between ensured delivery and potential missed emissions.
- Operator and pattern recommendations: map, flatMapLatest, catch, retry, stateIn, shareIn, event handling, and avoiding side-effects inside transforms.
- Testing approaches for Flow-based architectures using Turbine or similar.
Quick Start
Identify which Flow type fits a given UI scenario and apply the recommended patterns to migrate channels, ensure lifecycle-safe collection, and implement correct event handling.