# bloc

> Claude/Codex skill by [@verygoodopensource](https://omgskills.com/library/verygoodopensource/index.md) · 173 stars · Updated 2026-10-20

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.

Tags: a11y, ai, best-practices, bloc, claude-code, dart, flutter, i18n, l10n, plugin, skills, state-management, testing, very-good-analysis, very-good-cli

## Install

```sh
git clone https://github.com/VeryGoodOpenSource/vgv-ai-flutter-plugin /tmp/vgv-ai-flutter-plugin && ln -s /tmp/vgv-ai-flutter-plugin/skills/bloc ~/.claude/skills/bloc
```

## From README

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:bloctest 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 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...

## Links

- HTML page: https://omgskills.com/library/verygoodopensource/vgv-ai-flutter-plugin/skills/bloc/
- GitHub: https://github.com/VeryGoodOpenSource/vgv-ai-flutter-plugin
- Author: [@verygoodopensource](https://omgskills.com/library/verygoodopensource/index.md)

## More from this repo

- [accessibility](https://omgskills.com/library/verygoodopensource/vgv-ai-flutter-plugin/skills/accessibility/index.md) — Audits or remediates Flutter widgets against WCAG 2.2 conformance levels A, AA, or AAA across iOS, Android, Web, macOS,...
   - [@verygoodopensource](https://omgskills.com/library/verygoodopensource/index.md) · 173 stars
- [animations](https://omgskills.com/library/verygoodopensource/vgv-ai-flutter-plugin/skills/animations/index.md) — Best practices for Flutter animations using the built-in animation framework, covering implicit animations, explicit...
   - [@verygoodopensource](https://omgskills.com/library/verygoodopensource/index.md) · 173 stars
- [create-project](https://omgskills.com/library/verygoodopensource/vgv-ai-flutter-plugin/skills/create-project/index.md) — Scaffold a new Dart or Flutter project from a Very Good CLI template, covering the flutter\_app, dart\_package,...
   - [@verygoodopensource](https://omgskills.com/library/verygoodopensource/index.md) · 173 stars
