What problem does it solve?
Flutter developers often struggle to choose between Bloc and Cubit, mismanage bloc lifecycles, or wire UI widgets incorrectly, leading to memory leaks, unnecessary rebuilds, and tangled architecture.
Core Features & Use Cases
- Decision Guidance: Clear rules for choosing Cubit for simple method-based state updates versus Bloc for event-driven flows with loading, success, and failure transitions.
- Lifecycle & UI Binding Rules: Covers when to call close(), how BlocProvider manages disposal, and when to use BlocBuilder, BlocListener, BlocConsumer, and BlocSelector.
- Testing & Pitfall Avoidance: Provides testing patterns for blocs and cubits plus a checklist of common mistakes like duplicate dependencies and app-wide god blocs.
- Use Case: When building a checkout flow in a Flutter app, use this Skill to model it as an event-driven Bloc with explicit states, wire it via BlocProvider, and write transition tests.
Quick Start
Ask the agent to help you implement state management for a Flutter feature using Bloc or Cubit and explain which one fits your use case.