Skip to content

Poorgramer-Zack/dart-expert-skills / skills/bloc-signals

bloc-signals

Verified

Implement, review, test, and migrate Dart and Flutter code that uses BlocSignal (bloc_signals, bloc_signals_flutter, bloc_signals_test), the BLoC-style API built on signals. Use this when the code imports package:bloc_signals, extends BlocSignal or CubitSignal, uses BlocSignalProvider, BlocSignalBuilder, BlocSignalListener, or context.select, or when the user asks how BlocSignal differs from flutter_bloc or wants to move from BLoC to synchronous signal-based state.

BlocSignal

BlocSignal keeps the BLoC event model (events in, state out) on top of Rody Davis's signals v7 primitives. Its updates are synchronous: emit changes state immediately, with no stream and no microtask. It is young and its API can change, so verify against the installed package source before editing code.

Start from the installed package

  1. Read the consumer project's pubspec.yaml and pubspec.lock to find the bloc_signals version.
  2. Check every type and member you plan to use against the installed source (package:bloc_signals/...). Do not assume parity with package:bloc or Riverpod.
  3. Read the matching reference below, then make the smallest change that keeps behavior.

Route the task

Contracts to preserve

  • Constructors take named initialState:. Write : super(initialState: 0), not : super(0).
  • emit is synchronous, and it skips a value equal to the current state.
  • add returns void. Synchronous handlers finish before add returns.
  • close() is idempotent, disposes effects created with createEffect, and drops events after closure.
  • Read raw values with stateValue (or value) inside methods and handlers. state returns a ReadonlySignal for reactive bindings.
  • BlocSignalProvider(create:) is lazy by default and owns its bloc. BlocSignalProvider.value does not own it.
  • context.watch<T>() tracks provider replacement, not state changes. Use BlocSignalBuilder to rebuild on state.
  • Never create an effect or computed inside build. Give it an explicit owner and a disposal path.
  • A global BlocSignalObserver is a single slot. Compose observers instead of replacing them.

Packages

  • bloc_signals: core (pure Dart).
  • bloc_signals_flutter: Flutter providers, builders, listeners, selectors.
  • bloc_signals_test: blocSignalTest helpers.
  • Optional: bloc_signals_lint, bloc_signals_hydrate, bloc_signals_replay, bloc_signals_riverpod, bloc_signals_devtools, bloc_signals_jaspr.

Validation

Run flutter analyze and the nearest tests. The examples in these references were compiled and tested against bloc_signals 1.7.0, bloc_signals_flutter 1.5.0, and bloc_signals_test 1.0.3.

finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall