compose-viewmodel-bridge
CommunityBridge ViewModel StateFlow to Compose lifecycle
Software Engineering#lifecycle#android#compose#viewmodel#stateflow#stateInWhileSubscribed#WhileSubscribedOrRetained
AuthorshaharKeisarApps
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This skill enables seamless integration between ViewModel StateFlow data and Compose UI, ensuring that UI state is collected with proper lifecycle awareness and resilience during configuration changes.
Core Features & Use Cases
- Lifecycle-safe state collection: Employs collectAsStateWithLifecycle to prevent leaks and unnecessary recompositions.
- Configuration-change resilience: Applies a robust state-collection pattern that persists UI state across rotations and theme changes.
- ViewModel-Compose bridging: Demonstrates how to expose UI state from Hilt-enabled ViewModels and render it in Compose screens.
- Use Case: Ideal for screens that observe dynamic app state from a ViewModel and must remain stable during navigation and device configuration changes.
Quick Start
Use the skill to wire a StateFlow from your ViewModel to a Composable using collectAsStateWithLifecycle(). Example (conceptual): val viewModel: MoviesViewModel = viewModel() val movies by viewModel.movies.collectAsStateWithLifecycle()
Dependency Matrix
Required Modules
None requiredComponents
scripts
💻 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: compose-viewmodel-bridge Download link: https://github.com/shaharKeisarApps/MoviesAndBeyond/archive/main.zip#compose-viewmodel-bridge 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 223,000+ vetted skills library on demand.