bloc-state

Implement Flutter state management with Bloc and Cubit patterns.

1|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/dimitriRemoiville/cc-mobile --skill bloc-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bloc-state
Source: https://github.com/dimitriRemoiville/cc-mobile/tree/main/plugins/cc-mobile-flutter/skills/bloc-state
Command: npx skills add https://github.com/dimitriRemoiville/cc-mobile --skill bloc-state

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manage complex Flutter UI state with clear, testable patterns using Bloc and Cubit, ensuring deterministic transitions and clean separation of concerns.

Core Features & Use Cases

  • Guidance on when to use Bloc vs Cubit, event/state design with Freezed unions, and applying bloc_concurrency transformers for proper concurrency handling.
  • Best practices for state shapes (union vs single state), one-shot effects, error handling, and testing with bloc_test.
  • Real-world scenarios like authentication flows, form submissions, and live search where ordering and cancellation matter.

Quick Start

Create a new Bloc, wire events to handlers, and observe state transitions.

Frequently Asked Questions about bloc-state

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

FAQPage Schema
When should I use Bloc vs Cubit for Flutter state management?

Use Cubit for simpler state management with direct function calls, and choose Bloc when you need explicit event-to-state mapping for complex Flutter state management flows like authentication or form submissions.

How do I handle concurrency and event ordering in a Flutter Bloc?

Handle Bloc concurrency and event ordering by applying bloc_concurrency transformers such as restartable and droppable, which manage overlapping events and cancellation effectively in live search scenarios.

How do I design Bloc events and states using Freezed unions?

Design Bloc events and states using Freezed unions to enforce clear state shapes and ensure deterministic transitions, avoiding the anti-pattern of encoding one-shot effects directly as state values.

Can I test Bloc state transitions and event mapping in Flutter?

Yes, you can test Bloc state transitions and event mapping using bloc_test, which allows you to verify deterministic state changes and mock repository data access for authentication and form flows.

What is the best way to separate data access from Bloc logic in Flutter?

The best way to separate data access from Bloc logic in Flutter is to inject repositories for data fetching, ensuring your Bloc or Cubit focuses solely on event-to-state mapping and state transitions.

Why should I avoid encoding effects as states in Bloc state management?

Avoid encoding effects as states in Bloc state management because it breaks deterministic transitions; instead, use proper state shapes with Freezed unions and handle one-shot effects separately from the state tree.