flutter-bloc-feature-pattern

Generates DartBLoc feature scaffolds with freezed sealed states and concurrency transformers for Flutter apps.

Updated May 16, 2026
One-click install
npx skills add https://github.com/abdallhMoukdad/flutter-bloc-skills --skill flutter-bloc-feature-pattern
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flutter-bloc-feature-pattern
Source: https://github.com/abdallhMoukdad/flutter-bloc-skills/tree/main/skills/flutter-bloc-feature-pattern
Command: npx skills add https://github.com/abdallhMoukdad/flutter-bloc-skills --skill flutter-bloc-feature-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building a new Bloc feature often turns into inconsistent file layouts, incomplete state handling, and subtle concurrency bugs that only show up under real user interaction.

Core Features & Use Cases

  • Canonical event/state/bloc trio: Generates the standard <feature>_event.dart, <feature>_state.dart, and <feature>_bloc.dart structure so repositories are called only from the Bloc.
  • Exhaustive sealed states with Freezed: Encourages freezed sealed unions (e.g., Initial, Loading, Loaded, Failure) to make UI switch rendering compile-time exhaustive.
  • Correct bloc_concurrency transformer choices: Helps decide between droppable(), restartable(), sequential(), and concurrent() based on the semantics of each event handler.
  • Precision UI wiring: Uses BlocBuilder for rebuilds, BlocSelector for fine-grained updates, and BlocListener for side effects like navigation and snackbars.
  • Optional persistence guidance: Explains when to use HydratedBloc and how to implement JSON serialization and stable storagePrefix safely.

Quick Start

Ask the skill to scaffold a new feature called “cart”, including the event/state/bloc trio with freezed sealed states and the correct bloc_concurrency transformers for each handler.

Frequently Asked Questions about flutter-bloc-feature-pattern

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

FAQPage Schema
How do I structure a new Flutter Bloc feature with freezed sealed states?▼

Structure a Flutter Bloc feature by generating a canonical event, state, and bloc file trio. Use freezed sealed unions for states to ensure compile-time exhaustive UI switch handling across loading, loaded, and failure scenarios.

When should I use different bloc_concurrency transformers in Flutter?▼

Select bloc_concurrency transformers based on event semantics: use droppable to prevent duplicate processing, restartable to cancel in-flight fetches, and sequential to enforce strict ordering for mutating state operations.

What is the best way to wire Flutter Bloc state updates to the UI?▼

Wire Flutter Bloc state updates by using BlocBuilder for full rebuilds, BlocSelector for fine-grained updates, and BlocListener for side effects like navigation or displaying snackbars without triggering widget rebuilds.

Can I use HydratedBloc for local persistence in a Flutter feature scaffold?▼

Yes, you can use HydratedBloc for local persistence by implementing JSON serialization and defining a stable storagePrefix to safely cache state locally and restore it across app restarts.

Why does my Flutter Bloc state handling have missing cases in the UI switch?▼

Missing UI switch cases occur when states are not defined as freezed sealed unions. Using freezed makes state matching compile-time exhaustive, forcing the UI to explicitly handle every initial, loading, loaded, and failure state.

Do I need freezed to scaffold scalable Bloc features in Flutter?▼

You need freezed to scaffold scalable Bloc features because it generates sealed state classes, ensuring compile-time exhaustive switch handling and preventing incomplete UI rendering when adding new state variants.