android-legacy-state
$
npx mdskill add HoangNguyen0403/agent-skills-standard/android-legacy-stateIntegrate ViewModel state with Views using Coroutines and Lifecycle on Android for Fragment/Activity
- Ensures LiveData is observed with viewLifecycleOwner to prevent lifecycle leaks.
- Uses StateFlow exclusively in new code, and observes LiveData with viewLifecycleOwner in legacy code.
- Prevents crashes by collecting flows only when the View is started using repeatOnLifecycle(Lifecycle.State.STARTED).
- Delivers state updates directly to Views via Coroutines and Lifecycle-aware coroutines for efficient state management.
SKILL.md
.github/skills/android-legacy-stateView on GitHub ↗