android-coroutines-expert

Installation
SKILL.md

Coroutines & Concurrency Mastery โšก๐Ÿงต

A strict rulebook to prevent thread-blocking, memory leaks, and lost UI events in modern Android applications.

โšก When to Use

  • ViewModel Logic: Launching coroutines for network/database requests.
  • One-Time UI Events: Showing Snackbars, Toasts, or Navigation triggers.
  • Parallel Work: Running multiple non-blocking tasks.

๐Ÿšฆ Rule 1: The UI Event Dilemma (StateFlow vs Channel)

You must explicitly distinguish between UI State (things that persist on rotation) and UI Events (things that happen once, like a Toast or Navigation).

  • UI STATE: Use MutableStateFlow.
  • UI EVENTS: Use an un-buffered Channel exported as a Flow. NEVER use SharedFlow with replay = 0 or MutableStateFlow for one-time events, because if the app rotates, the event might be dropped or replayed twice.
Installs
11
GitHub Stars
11
First Seen
Aug 6, 2026