What problem does it solve?
Kotlin coroutine and Flow code often becomes fragile, hard to test, and prone to leaks or cancellation bugs when scopes, error handling, and reactive operators are used inconsistently.
Core Features & Use Cases
- Structured Concurrency: Uses scope hierarchies,
coroutineScope, and supervisorScope to run concurrent work safely and deterministically without GlobalScope.
- Flow Architecture Patterns: Shows practical approaches for cold flows,
StateFlow for UI state, SharedFlow for one-time events, and combining multiple flows into a single state model.
- Correct Operator Usage & Reliability: Covers common operators like
debounce, distinctUntilChanged, flatMapLatest, plus retry strategies with exponential backoff.
- Testing & Cancellation Safety: Demonstrates coroutine/Flow testing with
runTest, turbine-style assertions, fakes with MutableStateFlow, and cooperative cancellation patterns.
Quick Start
Tell the AI to generate a coroutine + Flow-based ViewModel that loads multiple resources in parallel, exposes StateFlow UI state, emits SharedFlow one-time navigation/snackbar effects, and includes a test that verifies the initial loading and the final populated state.