content/flutter/skills/state-management/bloc-cubit/SKILL.md
Use when working with Flutter Bloc/Cubit state management. Covers when to choose Bloc vs Cubit, how to use bloc and flutter_bloc together, lifecycle, testing, and safe defaults.
npx skillsauth add andrewyng/context-hub bloc-cubitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when building Flutter state management with bloc and flutter_bloc.
Cubit for simple, direct state updates.Bloc for event-driven flows, transitions, and replayable business logic.bloc in Dart-only projects.flutter_bloc in Flutter apps when you need widgets like BlocProvider, BlocBuilder, or BlocListener.flutter_bloc, you do not need to add bloc separately in a Flutter app because flutter_bloc depends on it.Choose Cubit when:
Choose Bloc when:
For Dart-only code:
blocflutter_bloc unless Flutter widgets are neededFor Flutter UI code:
flutter_blocbloc transitivelyBlocProvider at the feature boundaryBlocBuilder for rebuilds and BlocListener for side effectsPrefer this structure:
Keep state immutable.
Keep events explicit when using Bloc.
Keep one bloc or cubit per feature responsibility.
close().BlocProvider.BlocProvider or MultiBlocProvider to let Flutter manage disposal.new or a constructor outside the widget tree, you own its lifecycle.Use BlocBuilder when the widget should rebuild from state.
Use BlocListener when the widget should react without rebuilding.
Use BlocConsumer only when both are needed in one place.
Use buildWhen and listenWhen when rebuilds or listeners need narrowing.
Use BlocSelector when only one field should drive rebuilds.
Cubit by calling methods and asserting emitted states.Bloc by adding events and asserting the transition sequence.Bloc for trivial local state.bloc and flutter_bloc in a Flutter app when only flutter_bloc is needed.close() for manually managed instances.When writing code or advising on design:
bloc or flutter_blocbloc = core logic packageflutter_bloc = Flutter UI integration packageCubit = method-based updatesBloc = event-based transitionsclose()close()development
Use when working with Flutter Riverpod state management. Covers providers, consumers, refs, containers, overrides, async state, code generation, testing, and safe defaults.
development
Build production-ready Tavily integrations with best practices for web search, content extraction, crawling, and research in agentic workflows, RAG systems, and autonomous agents
tools
Guide for AI agents to source electronic components using parts-mcp — tool sequencing, decision patterns, and multi-step workflows
tools
Common login automation patterns for web apps using Playwright