vgv-bloc
Installation
SKILL.md
Bloc
State management library for Dart and Flutter using the BLoC (Business Logic Component) pattern to separate business logic from the presentation layer.
Core Standards
Apply these standards to ALL Bloc/Cubit work:
- Use
blocTest()frompackage:bloc_testfor all Bloc and Cubit tests — never rawtest()with manual stream assertions - Use
package:mocktailfor mocking — neverpackage:mockito - No bloc-to-bloc direct dependencies — blocs communicate through the UI or shared repositories
- Page/View separation — Page provides the Bloc/Cubit via
BlocProvider, View consumes viaBlocBuilder/BlocListener - Sealed classes for events and multi-state types — enables exhaustive pattern matching with Dart 3
switch - Equatable for all states and events — extend
Equatableand overridepropsfor value equality - Business logic in Bloc/Cubit only — never in widgets, pages, or views
- Single responsibility — one Bloc/Cubit per feature concern
- Emit only after async checks — use
emitonly inside the handler callback