Migrating to Kotlin State & Shared Flows
summary
Explains concrete migration steps: replace ConflatedBroadcastChannel with StateFlow and regular BroadcastChannel with SharedFlow, map send→emit (trySend→tryEmit), and use extraBufferCapacity and replay to match old semantics. Default SharedFlow has replay count=0 by default and never completes normally; emit is suspending. Shows shareIn/stateIn start policies — eager, lazy, whileSubscribed — and demonstrates cancellation triggering onCompletion. Covers buffer overflow handling with overflow strategies: suspend, dropOldest, dropLatest.
AI-written summary · about
