unyo-bloc-state-management
CommunityManage cubits, states & UI side effects
System Documentation
What problem does it solve?
This skill documents a consistent pattern for managing Cubit state and orchestrating UI side effects in the Unyo Flutter app so business logic can trigger navigation, dialogs, and snackbars without holding BuildContext, avoid mutable state, and prevent memory leaks from subscriptions.
Core Features & Use Cases
- Immutable Freezed states with effects: States implement HasEffects and include a default effects list used to express navigation and feedback intents from the cubit.
- Cubits with EffectMixin: Cubits mix in EffectMixin, implement copyStateWithEffects and a logger, and emit state changes and AppEffect instances for the UI to handle.
- UI effect handler & DI wiring: BlocListener reads state.effects, delegates to AppEffectHandler to execute routes/dialogs/snackbars, then calls clearEffects; cubits are registered via the DI locator and subscribe to notifiers with proper cancellation in close.
Quick Start
Create a Freezed state that implements HasEffects with a default effects list, implement a Cubit that mixes in EffectMixin and emits state.copyWith(effects: ...), register the cubit in the DI locator, and add a BlocListener in the UI to handle and clear AppEffect instances.
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: unyo-bloc-state-management Download link: https://github.com/K3vinb5/Unyo/archive/main.zip#unyo-bloc-state-management 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.