flutter-state-bloc

Implements Bloc and Cubit event-driven state management in Flutter Dart projects.

Updated Jun 13, 2026
One-click install
npx skills add https://github.com/22Teikk/22Teikk-Agent-Skills-Hub --skill flutter-state-bloc-22teikk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flutter-state-bloc
Source: https://github.com/22Teikk/22Teikk-Agent-Skills-Hub/tree/main/packs/flutter/skills/flutter-state-bloc
Command: npx skills add https://github.com/22Teikk/22Teikk-Agent-Skills-Hub --skill flutter-state-bloc-22teikk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Flutter apps need predictable, testable state management with a clear audit trail of how state changes over time. This Skill guides the implementation of Bloc 9.x / Cubit patterns so every user intent becomes a typed event, every transition is deterministic, and every change is observable and testable. ## Core Features & Use Cases - Cubit vs Bloc decision guidance: Start with simple Cubit classes and promote to Bloc<Event, State> when you need concurrency transformers, event logs, or multiple inputs converging on one state machine. - Provider wiring and side effects: Correct use of BlocProvider, MultiBlocProvider, RepositoryProvider, BlocBuilder, BlocListener, and BlocConsumer, with navigation and snackbars kept out of builders. - Audit trail and testing: Global BlocObserver for event/transition logging and crash reporting, plus bloc_test suites with mocktail asserting ordered state sequences for every handler branch. - Use Case: When building a payments or multi-step wizard feature in a Flutter app that declares flutter_bloc, use this Skill to model events and Equatable states, wire providers at the right scope, and write bloc tests covering success, empty, and failure branches. ## Quick Start Ask the AI to implement a Bloc or Cubit for a Flutter feature with Equatable states, BlocProvider wiring, and bloc_test coverage.

Frequently Asked Questions about flutter-state-bloc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Cubit and Bloc in Flutter?▼

Start with Cubit when a screen has a few direct actions like load() or retry() and you only care what the state is. Promote to Bloc<Event, State> when you need debounce or restart transformers, an event log, or multiple event sources feeding one state machine.

How do I test a Bloc with bloc_test and mocktail?▼

Use blocTest with build to construct the bloc with a mocked repository, act to dispatch the event, and expect to assert the ordered state sequence. Register fallback values for custom types and write one blocTest per handler branch, including failure cases.

Bloc vs Riverpod for Flutter state management?▼

Bloc models state as an event-to-handler state machine with a built-in audit trail via BlocObserver, suiting regulated or event-sourced domains. Riverpod uses a reactive dependency graph with less boilerplate. Pick exactly one per project and never mix them in the same subtree.

Why does my BlocBuilder rebuild too often in Flutter?▼

Excessive rebuilds usually come from missing Equatable props on states, using context.watch in build instead of BlocBuilder, or omitting buildWhen. Add complete props lists and scope rebuilds with buildWhen or context.select for narrow values.

When should I not use Bloc for Flutter state?▼

Avoid Bloc for ephemeral widget-local state like animation controllers or text fields, which belong in StatefulWidget. Also skip it in Riverpod or ChangeNotifier codebases, and for screens with a single boolean toggle where local state suffices.