Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
← Back to list

Bloc State Management Rules

A practical rulebook for designing, implementing, and testing Cubits and Blocs in Flutter with bloc/flutter_bloc.

Dev & CodingIntermediate★ 646⑂ 67AI score 9/10Last updated: Sep 14, 2026

What it does

Makes Claude Code follow canonical bloc-ecosystem conventions whenever it writes Flutter state management code.

  • Cubit vs Bloc decision table: Cubit by default, Bloc when you need event traceability or transformers (debounce/throttle).
  • Naming conventions: past-tense events (LoginButtonPressed), noun states (LoginInProgress).
  • State modeling: when to use sealed classes with exhaustive switch vs a single class with a status enum, plus Equatable, @immutable, and copyWith rules.
  • Widget wiring: reference table for BlocProvider, BlocBuilder, BlocListener, BlocConsumer, BlocSelector, and context.read vs watch rules.
  • Architecture: Presentation → Business Logic → Data (Repository → DataProvider) boundaries, no bloc-to-bloc calls.
  • Testing: ready-to-copy bloc_test + mocktail templates for success and failure paths.
  • Common pitfalls table with concrete fixes.

Who it's for

  • Flutter developers building medium-to-large apps on bloc/flutter_bloc
  • Tech leads standardizing state management style across a team
  • Teams migrating from setState/Provider to bloc
  • Anyone who wants AI-generated state code to be predictable and reviewable

Examples

  1. "Create a Cubit for the login feature" → generates a status-enum state class with copyWith and constructor-injected repository.
  2. "Refactor this screen from setState to bloc" → defines sealed states and splits rebuild logic (BlocBuilder) from side effects (BlocListener).
  3. "Write tests for CartCubit" → produces blocTest cases asserting the loading/success/failure emission order with proper tearDown.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/evanca/flutter-ai-rules/HEAD/skills/bloc/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
↓ Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the skills/bloc folder from the GitHub repo evanca/flutter-ai-rules into my ~/.claude/skills/bloc/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/evanca/flutter-ai-rules.git && mkdir -p ~/.claude/skills && cp -r flutter-ai-rules/skills/bloc ~/.claude/skills/

⚠ This is a third-party skill. Check the source repository before installing.

  1. Open a terminal.
  2. Clone the repository: git clone https://github.com/evanca/flutter-ai-rules.git
  3. Create the skills folder: mkdir -p ~/.claude/skills
  4. Copy just this skill: cp -r flutter-ai-rules/skills/bloc ~/.claude/skills/
  5. Verify it exists: ls ~/.claude/skills/bloc/SKILL.md
  6. Restart Claude Code inside your Flutter project directory.
  7. Ask something like "create a Cubit for this feature" and the skill activates automatically. (Your project needs the bloc/flutter_bloc packages, plus bloc_test and mocktail for tests.)