The BlocSignal monorepo consists of 10 modular packages:
- 🚀 Synchronous State Propagation: Eliminates microtask-queue latency found in Stream-based BLoC implementations.
- 🎯 Fine-Grained Reactivity: Leverages Rody Davis's signals v7 primitives for highly performant and precise rebuilds.
- 🧹 Automatic Lifecycle Management: Automatically manages and tears down effects and listeners via
SignalModelintegration on close. - 🔍 Global Observation: Hook in a
BlocSignalObserverto easily log, trace, and monitor events and transitions globally. - 🔀 Automatic De-duplication: State transitions are automatically de-duplicated using standard
==equality or customequals. - 🛠️ DevTools & VM Service RPC: Remote action dispatching, trace panels, diff inspectors, and leak detection via
bloc_signals_devtools. - 💾 State Persistence: Synchronous initial state hydration across app restarts via
bloc_signals_hydrate. - ↩️ Undo & Redo Replay: Automatic state history tracking, stack limits, and state filtering via
bloc_signals_replay. - 📊 OpenTelemetry Tracing: Built-in support for distributed tracing with standard OpenTelemetry spans via
bloc_signals_otel. - 🌁 Universal Interoperability: Seamlessly adapt between BLoC, Riverpod, Provider, and Flutter Listenable primitives.
BlocSignal combines two foundational pillars of the Dart & Flutter state management ecosystem:
- BLoC Architecture (bloclibrary.dev): Event-driven state machine discipline, state separation, and enterprise observability (
BlocSignalObserver). - Signals Primitives (signals.dart): Fine-grained reactive dependency graphs and zero-latency value holding.
- ⚡ Synchronous vs. Asynchronous Emission: Unlike classic
package:blocwhich dispatches state changes on microtask-queue Streams,BlocSignalupdates propagate synchronously. Callingemit(newState)triggers downstream calculations and widget rebuilds in the exact same frame. - 🔑 Named Constructor Initial State (
initialState:): Constructors require the named parameterinitialState:(for example,: super(initialState: 0)), unlike Felix BLoC's positional: super(0). - 📊 Explicit State Value Access (
stateValue): UsestateValue(orstate.value) to read rawStateTypevalues in methods or event handlers (for example,emit(stateValue + 1)), whilestateexposesReadonlySignal<StateType>for reactive signal bindings. - 🎯
context.select<B, R>2-Argument Generic Signature: Unlike Riverpod (3 generic arguments) or classicflutter_bloc,context.select<B, R>takes 2 generic type parameters (<Bloc, SelectedType>) and passes theblocinstance directly to the callback:(bloc) => bloc.stateValue.property. - 📦 Zero
RepositoryProviderBloat: Dependency injection inBlocSignalis handled directly viaBlocSignalProvider(or Riverpod/Jaspr context providers) without forcing a separateRepositoryProviderwrapper. - 🔒 Streamless Event Concurrency: Event concurrency transformers (
droppable,sequential,restartable,Mutex) run via pure Dart higher-order functions without stream allocations or Rx dependencies.
- Architectural Decision Matrix: State modeling rubric comparing raw Signals,
CubitSignal,BlocSignal, and mixins. - Migration Guide: Moving from classic
package:bloc/package:flutter_bloctoBlocSignal. - Riverpod Interop & Migration: Converting between Riverpod providers and
BlocSignal. - Universal Interoperability Guide: State bridge across BLoC, Riverpod, and Provider.
- State Hydration: Persistent state storage and initial hydration semantics.
- DevTools Extension: DevTools inspector, timeline trace panel, and memory leak alerts.
- Static Analysis & Lints: Analyzer rules and IDE diagnostics.
- OpenTelemetry Telemetry: Distributed tracing spans and observer setup.
This repository includes a pre-packaged AI Agent Plugin & Skill bundle (bloc-signals) containing architectural best practices, lifecycle contracts, and migration guides for AI coding assistants (such as Claude Code, Antigravity, Gemini, Cursor, or Codex):
- Skill Bundle:
plugins/bloc-signals/skills/bloc-signals/ - Marketplace Manifests: Available via
.claude-pluginand.agents/pluginsmarketplace definitions. - Validation: Run
dart run tool/validate_agent_plugin.dartto verify marketplace catalogs and skill bundle integrity.
BlocSignal is heavily inspired by and builds upon the incredible work of:
- Felix Angelov and the original bloc / flutter_bloc libraries.
- Rody Davis and the signals library.
- Remi Rousselet and Riverpod.
