Skip to content

Flutter Bloc/Cubit State Guide

Guides an agent to pick Bloc vs Cubit and apply Flutter state management best practices

Stars
13,984
Licence
MIT
Files
1 file

What it does

This is a written guide that teaches an AI agent how to set up and structure state management in Flutter apps using the bloc and flutter_bloc packages. Once installed, the agent helps you decide whether a feature should use a simple Cubit (direct method calls) or a Bloc (explicit events and transitions), explains which package to add, and follows rules for widget binding, disposing of instances, and writing tests. It only changes the advice and code the agent writes; it does not run anything by itself.

Great for

  • Flutter developers building or refactoring state management with bloc or flutter_bloc
  • Teams wanting consistent architecture rules (repository owns I/O, UI only dispatches and renders)
  • Developers new to Bloc who need help choosing between Cubit and Bloc

Skip it if

  • Projects using other state management libraries such as Riverpod, Provider or GetX, since the guidance is specific to bloc (the agent may mix patterns incorrectly)
  • Non-Flutter or non-Dart projects, where most of the content does not apply
  • Anyone expecting a verified or up-to-date API reference: the skill tells the agent to follow current docs, but the file itself contains no code samples or version numbers to check against

Try asking

  • “Should I use a Cubit or a Bloc for my Flutter shopping cart feature?”
  • “Set up flutter_bloc in my Flutter app and show a counter with BlocBuilder”
  • “Write unit tests for my AuthBloc that check the login event transitions”
  • “Review my widget code and tell me if I'm putting network calls in the UI”
Step-by-step guide: how to use Flutter Bloc/Cubit State GuideInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    bloc-cubit.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip bloc-cubit.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip bloc-cubit.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Name the feature you are building so the agent can apply the Cubit vs Bloc decision guide to it
  • Ask the agent to show the smallest working example first, as the skill recommends, then check it against current package docs
  • Verify package versions and API names yourself, since the skill does not pin any versions

What's inside

  • SKILL.md

Redistributed unmodified from andrewyng/context-hub under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.