Use `StateFlow` for persistent UI state and `SharedFlow` for one-off events. `StateFlow` always has a current value and replays the latest state to a new subscriber: ```kotlin private val _uiState = MutableStateFlow(UiState()) val uiState: StateFlow<UiState> = _uiState.asStateFlow() ``` Use it for loading, content, and error state that the UI should be able to render after recreation. `SharedFlow` is appropriate for events such as navigation, a snackbar, or a toast: ```kotlin private val _eve...
Scanned 9/5/2026
Install to Claude Code
npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-concurrency --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Android Concurrency?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-concurrency-c8a05a95)More formats (shields.io, HTML) on the badges page.
Use `StateFlow` for persistent UI state and `SharedFlow` for one-off events.
`StateFlow` always has a current value and replays the latest state to a new subscriber:
```kotlin
private val _uiState = MutableStateFlow(UiState())
val uiState: StateFlow<UiState> = _uiState.asStateFlow()
```
Use it for loading, content, and error state that the UI should be able to render after recreation.
`SharedFlow` is appropriate for events such as navigation, a snackbar, or a toast:
```kotlin
private val _events = MutableSharedFlow<UiEvent>()
val events: SharedFlow<UiEvent> = _events.asSharedFlow()
```
Configure `replay` only when late subscribers must receive a recent event. Do not use `SharedFlow` as a substitute for state that needs a current value.
Collect flows with lifecycle awareness: use `collectAsStateWithLifecycle()` in Compose or collect inside `repeatOnLifecycle` in Views.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!