flutter-bloc-setup

Configure a Flutter scaffold with pinned Bloc, Freezed, and HydratedBloc dependencies.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It removes the friction of setting up a consistent Bloc-based Flutter foundation by handling dependency wiring, app-level providers, persistence initialization, and the expected project structure upfront.

Core Features & Use Cases

  • Opinionated Bloc Stack Bootstrapping: Installs a pinned runtime dependency set for flutter_bloc, freezed, bloc_concurrency, and hydrated_bloc plus required generators for deterministic builds.
  • HydratedBloc Persistence That Won’t Crash: Initializes HydratedBloc.storage before runApp using the correct path_provider directory choice for durable persistence.
  • App-Wide State Management Infrastructure: Adds a root MultiRepositoryProvider for data-layer repositories and gates an AppBlocObserver on kDebugMode for transition/error logging during development.
  • Feature-Ready Project Layout: Establishes a clear lib/ folder structure with per-feature bloc/view organization and matching test paths to support downstream skills like flutter-bloc-feature-pattern and flutter-bloc-async-api.

Quick Start

Use flutter-bloc-setup to initialize your Flutter project so Bloc, Freezed, concurrency transformers, and HydratedBloc are correctly wired before writing any feature code.

Frequently Asked Questions about flutter-bloc-setup

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

FAQPage Schema
How do I set up a Flutter app with Bloc and HydratedBloc from scratch?

Set up a Flutter app with Bloc by installing pinned flutter_bloc, freezed, and hydrated_bloc dependencies, initializing HydratedBloc.storage before runApp using the documents directory, and wrapping the app in a typed MultiRepositoryProvider.

When should I migrate my Flutter app from Provider or ChangeNotifier to Bloc?

Migrate from Provider or ChangeNotifier to Bloc when you need structured state management, persistent state via HydratedBloc, and a feature-oriented folder architecture to support complex async or stream-driven workflows.

Why does HydratedBloc crash on initialization and how do I fix it?

HydratedBloc crashes on initialization if storage is not configured before runApp; fix this by initializing HydratedBloc.storage using the correct path_provider documents directory early in your main execution sequence.

What is the best way to structure a Flutter project for Bloc state management?

The best way to structure a Flutter project for Bloc is using a feature-oriented lib/ folder layout with per-feature bloc and view organization, plus matching test paths to support downstream feature implementation skills.

Can I use Freezed and bloc_concurrency in my existing Flutter state management setup?

Yes, you can integrate Freezed and bloc_concurrency into an existing Flutter setup by pinning the required runtime dependencies and code generators to ensure deterministic builds and immutable state classes.

Do I need to configure an AppBlocObserver for production Flutter Bloc apps?

Configure an AppBlocObserver only during development by gating it on kDebugMode to capture transition and error logging, keeping production builds clean from debug-level state instrumentation overhead.