Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder…

MITAuto-check passedMobile

Install Bloc

skills CLI
$ npx skills add VeryGoodOpenSource/vgv-ai-flutter-plugin --skill bloc -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install VeryGoodOpenSource/vgv-ai-flutter-plugin bloc --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/VeryGoodOpenSource/vgv-ai-flutter-plugin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/bloc .claude/skills/bloc && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bloc
GitHub stars
169
Token cost
~2k tokens
SKILL.md length
550 words
Files
6 (incl. references)
Skills in repo
15
Repo updated
First seen
Licence
MIT

At a glance

Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder…

  • Reviewing code that uses package:bloc
  • SKILL.md covers Core Standards, Cubit vs Bloc, Naming Conventions and Architecture, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Package:flutterbloc

What it does

Bloc is an agent skill from VeryGoodOpenSource/vgv-ai-flutter-plugin. Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder, BlocListener, and BlocSelector. Use when writing, modifying, or reviewing code that uses package:bloc, package:flutterbloc, or package:bloctest. Also use for any test of a class that extends Bloc or Cubit, including "write the unit tests for this bloc", "test my cubit", "add tests for LoginBloc", mocking a repository a bloc…

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `agents/openai.yaml`, `references/architecture.md` and `references/patterns.md`).

It sits in Mobile, covering Cross-platform mobile apps, State management and Unit testing. It works with Flutter and Dart. The repository describes itself as: AI plugin to enhance and accelerate Flutter & Dart development, built by Very Good Ventures. The licence is MIT.

When your agent uses it

  • Reviewing code that uses package:bloc
  • Package:flutterbloc
  • Package:bloctest
  • Any test of a class that extends Bloc

Example prompts

  • “write the unit tests for this bloc”
  • “test my cubit”
  • “add tests for LoginBloc”
  • “/bloc”

Requirements

  • Pre-approved tools (allowed-tools): Read, Glob, Grep

What it can do on your machine

Read from SKILL.md and the folder at commit 496a3c6. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are dart).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bloc loads about 2k tokens when it runs, and up to ~5.3k if it reads all its reference files. Until then it costs about 250 tokens; SKILL.md has 550 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~250
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from VeryGoodOpenSource/vgv-ai-flutter-plugin at commit 496a3c6, republished under its MIT licence (© VeryGoodOpenSource). 550 words, ~1,996 tokens.

Download SKILL.mdSave it as .claude/skills/bloc/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
bloc
description
Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder, BlocListener, and BlocSelector. Use when writing, modifying, or reviewing code that uses package:bloc, package:flutter_bloc, or package:bloc_test. Also use for any test of a class that extends Bloc or Cubit, including "write the unit tests for this bloc", "test my cubit", "add tests for LoginBloc", mocking a repository a bloc depends on, and asserting the states an event emits. Bloc and Cubit tests must use blocTest() from package:bloc_test with package:mocktail, so prefer this over the testing skill whenever the class under test is a Bloc or Cubit. Also use when a request pushes against these rules, such as injecting one bloc into another to read its state, calling a repository from a widget or build method, or keeping a Cubit for a feature that needs an event transformer such as debounce.
allowed-tools
Read, Glob, Grep

Bloc

State management library for Dart and Flutter using the BLoC (Business Logic Component) pattern to separate business logic from the presentation layer.


Core Standards

Apply these standards to all Bloc/Cubit work:

  • Use blocTest() from package:bloc_test for all Bloc and Cubit tests — never raw test() with manual stream assertions
  • Use package:mocktail for mocking — never package:mockito
  • build: constructs the bloc under test — return a new instance from the callback, never one built in setUp and shared, so every blocTest starts from a clean bloc and its lifecycle stays with blocTest
  • No bloc-to-bloc direct dependencies — blocs communicate through the UI or shared repositories
  • Page/View separation — Page provides the Bloc/Cubit via BlocProvider, View consumes via BlocBuilder/BlocListener
  • Sealed classes for events and multi-state types — enables exhaustive pattern matching with Dart 3 switch
  • Equatable for all states and events — extend Equatable and override props for value equality
  • Business logic in Bloc/Cubit only — never in widgets, pages, or views
  • Single responsibility — one Bloc/Cubit per feature concern
  • emit only inside the handler — call emit from the on<Event> callback or Cubit method that owns it, never from a stream subscription or callback that outlives the handler
  • Dart 3.13 primary constructors — on a Dart 3.13+ baseline, declare event, state, and widget fields as primary-constructor declaring parameters (class const ProfileRequested(final String userId) extends ProfileEvent) rather than this.field; keep the classic form only below 3.13

Cubit vs Bloc

AspectCubitBloc
APIFunctions → emit(state)Events → on<Event> → emit(state)
ComplexityLowHigher
TraceabilityLess (no event log)Full (events + transitions)
When to useSimple state, UI-driven logicComplex flows, event-driven, transforms
TestingCall methods, assert statesAdd events, assert states
Cubit Example
dart
class CounterCubit extends Cubit<int> {
  CounterCubit() : super(0);

  void increment() => emit(state + 1);
  void decrement() => emit(state - 1);
}
Bloc Example
dart
sealed class CounterEvent extends Equatable {
  const CounterEvent();

  @override
  List<Object> get props => [];
}

final class CounterIncrementPressed extends CounterEvent {}
final class CounterDecrementPressed extends CounterEvent {}

class CounterBloc extends Bloc<CounterEvent, int> {
  CounterBloc() : super(0) {
    on<CounterIncrementPressed>((event, emit) => emit(state + 1));
    on<CounterDecrementPressed>((event, emit) => emit(state - 1));
  }
}

Naming Conventions

Events

Pattern: BlocSubject + Noun + VerbPastTense

Event class nameMeaning
TodoListSubscriptionRequestedSubscribing to todo list stream
TodoListTodoDeletedDeleting a specific todo
TodoListUndoDeletionRequestedUndoing the last deletion
LoginFormSubmittedSubmitting the login form
ProfilePageRefreshedRefreshing the profile page
dart
sealed class TodoListEvent extends Equatable {
  const TodoListEvent();

  @override
  List<Object> get props => [];
}

final class TodoListSubscriptionRequested extends TodoListEvent {}

final class const TodoListTodoDeleted({required final Todo todo})
    extends TodoListEvent {
  @override
  List<Object> get props => [todo];
}
States
Subclass Approach (multiple state types)

Use when each state carries different data.

State class nameMeaning
LoginInitialNo action taken yet
LoginInProgressLogin request in flight
LoginSuccessLogin succeeded
LoginFailureLogin failed
dart
sealed class LoginState extends Equatable {
  const LoginState();

  @override
  List<Object> get props => [];
}

final class LoginInitial extends LoginState {}
final class LoginInProgress extends LoginState {}
final class const LoginSuccess({required final User user}) extends LoginState {
  @override
  List<Object> get props => [user];
}
final class const LoginFailure({required final String error})
    extends LoginState {
  @override
  List<Object> get props => [error];
}
Show full SKILL.md (209 more words)Show less
Single Class Approach (one state, multiple fields)

Use when all states share the same data shape: one class holding a status enum plus the data fields, with a copyWith for transitions. See references/patterns.md for the full shape.


Architecture

LayerContainsDepends on
PresentationPages, Views, WidgetsBusiness Logic
Business LogicBlocs, CubitsData
DataRepositories, Data ProvidersExternal sources
Data Layer

Repositories abstract data sources and provide a clean API for Blocs/Cubits. Mirror the feature folder structure under test/ for all test files.

See references/architecture.md for the repository example, feature folder structure, and test directory layout.


Flutter Widgets

Use BlocProvider to supply a Bloc or Cubit to a subtree, then BlocBuilder, BlocListener, BlocConsumer, or BlocSelector to consume it. Reach for BlocSelector when a rebuild should depend on one field rather than the whole state, and BlocListener for side effects such as navigation or a snackbar.

The rule that matters: context.read in callbacks (onPressed, onTap), context.watch or BlocBuilder in build. Never call context.watch outside a build method.

Additional Resources

© VeryGoodOpenSource, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in skills/bloc of VeryGoodOpenSource/vgv-ai-flutter-plugin.

  • SKILL.md
  • agents/openai.yaml
  • references/architecture.md
  • references/patterns.md
  • references/testing.md
  • references/widgets.md

Open the folder on GitHubat commit 496a3c6

Compare with similar skills

Bloc next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bloc compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bloc this skillVeryGoodOpenSource/vgv-ai-flutter-plugin169—~2kAutomated safety check: PassMIT
Flutter Riverpod State Managementandrewyng/context-hub14k—~1.1kAutomated safety check: PassMIT
Flutter Dart Code Reviewaffaan-m/ECC275k2 repos~5.8kAutomated safety check: NotesMIT
Signals for Flutterrodydavis/signals.dart819—~1.9kAutomated safety check: PassApache-2.0
Flutter Bloc and Cubitandrewyng/context-hub14k—~998Automated safety check: PassMIT
Dart Lifecycle Disposed Flag Overloaddivinevideo/divine-mobile266—~2kAutomated safety check: PassMPL-2.0

Similar skills

  • Guides Flutter state management with Riverpod: choosing provider types, wiring ConsumerWidgets, handling async state and lifecycle, and overriding providers in tests.

    14k GitHub stars~1.1k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance…

    275k GitHub starsUsed in 2 repos~5.8k tokens
    MobileAuto-check: notes
  • Signals for Flutter

    rodydavis/signals.dart

    Reference for the signals_flutter package: reactive signals, computed values, effects, async signals and collection signals bound to Flutter widgets.

    819 GitHub stars~1.9k tokensUpdated 24 days ago
    MobileAuto-check passed
  • Flutter Bloc and Cubit

    andrewyng/context-hub

    Helps choose between Bloc and Cubit in Flutter and sets defaults for packages, lifecycle, widget binding and tests.

    14k GitHub stars~998 tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Dart Lifecycle Disposed Flag Overload

    divinevideo/divine-mobile

    Fix Dart/Flutter services where calling start() after stop() is a silent no-op because stop() sets a disposed (or similar) flag that start()'s guard short-circuits on.

    266 GitHub stars~2k tokensUpdated today
    MobileAuto-check passed
  • Flutter Expert

    FNOSP/FlyNarwhal

    A skill your agent uses when building cross-platform applications with Flutter 3+ and Dart.

    495 GitHub starsUsed in 2 repos~758 tokens
    MobileAuto-check passed

More from VeryGoodOpenSource/vgv-ai-flutter-plugin

All 15 skills in this repo
  • Accessibility

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Audits or remediates Flutter widgets against WCAG 2.2 conformance levels A, AA, or AAA across iOS, Android, Web, macOS, Windows, and Linux, covering Semantics labels and screen reader output under…

    169 GitHub stars~4.2k tokensUpdated 2 days ago
    Auto-check passed
  • Animations

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Best practices for Flutter animations using the built-in animation framework, covering implicit animations, explicit AnimationController animations, page transitions, and Material 3 motion tokens.

    169 GitHub stars~3.5k tokensUpdated 2 days ago
    Auto-check passed
  • Dart Flutter SDK Upgrade

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    VGV-specific reference for bumping Dart and Flutter SDK constraints across packages, covering pubspec.yaml environment constraints, CI workflow Flutter versions, and SDK upgrade PR preparation.

    169 GitHub stars~2.6k tokensUpdated 2 days ago
    Auto-check: notes
  • Internationalization

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Best practices for internationalization (i18n) and localization (l10n) in Flutter, using the built-in flutterlocalizations and intl setup with ARB files as the single source of truth.

    169 GitHub stars~1.6k tokensUpdated 2 days ago
    Auto-check passed
  • Layered Architecture

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    VGV layered monorepo architecture in Flutter: four layers Data, Repository, Business Logic, and Presentation, unidirectional dependency rules, and model transformation across layers.

    169 GitHub stars~4.6k tokensUpdated 2 days ago
    Auto-check passed
  • Material Theming

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Best practices for Flutter theming with Material 3, treating ThemeData as the single source of truth for colors, typography, component styles, and spacing.

    169 GitHub stars~2.3k tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Bloc

What does Bloc do?

Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder…. Bloc is an agent skill from VeryGoodOpenSource/vgv-ai-flutter-plugin. Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder, BlocListener, and BlocSelector.

When should I use Bloc?

Bloc fits situations like: reviewing code that uses package:bloc; package:flutterbloc; package:bloctest; any test of a class that extends Bloc.

How do I install Bloc in Claude Code?

Run `npx skills add VeryGoodOpenSource/vgv-ai-flutter-plugin --skill bloc -a claude-code`. Or copy the skill folder (skills/bloc in VeryGoodOpenSource/vgv-ai-flutter-plugin) into .claude/skills/bloc in your project. Claude Code loads it when a task matches its description.

How do I install Bloc in Codex?

Run `npx skills add VeryGoodOpenSource/vgv-ai-flutter-plugin --skill bloc -a codex`. Or copy the skill folder (skills/bloc in VeryGoodOpenSource/vgv-ai-flutter-plugin) into .agents/skills/bloc in your project. Codex loads it when a task matches its description.

Can I use Bloc in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add VeryGoodOpenSource/vgv-ai-flutter-plugin --skill bloc -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bloc, .gemini/skills/bloc, .github/skills/bloc and .opencode/skills/bloc in your project.

What does Bloc need to run?

SKILL.md names no scripts, command-line tools or credentials: Bloc is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Glob, Grep.

Does Bloc access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bloc safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bloc use?

Bloc is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bloc use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.3k tokens, read only when the agent opens those files.

What are the alternatives to Bloc?

Skills that share tags, products or a category with Bloc: Flutter Riverpod State Management (andrewyng/context-hub, 14k stars), Flutter Dart Code Review (affaan-m/ECC, 275k stars), Signals for Flutter (rodydavis/signals.dart, 819 stars) and Flutter Bloc and Cubit (andrewyng/context-hub, 14k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bloc?

VeryGoodOpenSource (a GitHub organization) maintains it in VeryGoodOpenSource/vgv-ai-flutter-plugin, which has 169 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on October 6, 2026.

Source: VeryGoodOpenSource/vgv-ai-flutter-plugin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.