kotlin-flow-state-event-modeling
CommunityPrevent broken UI state and lost events.
Authorsoygabimoreno
Version1.0.0
Installs0
System Documentation
What problem does it solve?
It solves the common Kotlin Flow mistakes that cause lost one-shot events, stale UI state, and unsafe state initialization that leaks placeholder/sentinel domain values into the app.
Core Features & Use Cases
- Correctly model UI state vs one-shot events: Use StateFlow for always-available state and Buffered Channel/receiveAsFlow for exactly-once navigation/snackbar events.
- Avoid concurrency bugs in MutableStateFlow: Prefer MutableStateFlow.update to prevent lost updates from read-modify-write patterns.
- Prevent inefficient or incorrect sharing: Ensure stateIn is defined once (as a val) and choose SharingStarted.WhileSubscribed only when stale cached .value is acceptable.
- Keep synchronous access when deriving state: Don’t rely on .map over StateFlow when consumers need synchronous .value; terminate with .stateIn.
Quick Start
Use the kotlin-flow-state-event-modeling skill to review a ViewModel’s StateFlow/SharedFlow/Channel design and identify where events may drop, where .value may go stale, or where update/stateIn decisions could cause concurrency or performance issues.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: kotlin-flow-state-event-modeling Download link: https://github.com/soygabimoreno/Los-ANDROIDES/archive/main.zip#kotlin-flow-state-event-modeling Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.