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

Bloc State Management Rules

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

Dev & CodingIntermediate61759AI score 9/10Last updated: Aug 21, 2026

What it does

  • Gives a clear decision table for Cubit vs Bloc (simple state → Cubit; event traceability, debounce/throttle → Bloc with transformers).
  • Enforces naming conventions (past-tense events, noun states) and explains when to model state as a sealed class hierarchy versus a single class with a status enum.
  • Codifies Equatable/@immutable/copyWith rules, a lookup table for BlocProvider, BlocBuilder, BlocListener, BlocConsumer, BlocSelector, and the three-layer boundary (Presentation → Bloc → Repository → DataProvider).
  • Ships ready-to-copy bloc_test + mocktail test templates plus a pitfalls table (duplicate emissions, missing props, logic in widgets).

Who it's for

  • Flutter developers and teams standardizing on the bloc architecture.
  • Tech leads who want consistent conventions and review criteria.
  • Anyone who wants Claude Code to generate idiomatic Cubit/Bloc code every time.

Examples

  1. "Create a Cubit for the login feature" → produces a status-enum state class with copyWith and a proper loading/success/failure emit flow.
  2. "Refactor this screen from setState to bloc" → moves logic into a Cubit and rewires the UI with BlocBuilder plus BlocListener for snackbars/navigation.
  3. "Write tests for LoginCubit" → generates blocTest cases asserting emitted state sequences for both success and thrown-exception paths.

· · · 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/bloc

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

  1. Open a terminal and clone the repo: git clone https://github.com/evanca/flutter-ai-rules.git
  2. Create the skills directory if needed: mkdir -p ~/.claude/skills
  3. Copy just this skill: cp -r flutter-ai-rules/skills/bloc ~/.claude/skills/bloc
  4. Verify that ~/.claude/skills/bloc/SKILL.md exists.
  5. Restart Claude Code; the skill activates automatically when you ask for Cubit/Bloc work in a Flutter project.
  6. Make sure your pubspec.yaml includes flutter_bloc and equatable (plus bloc_test and mocktail for tests) so the sample code compiles as-is.