Skip to content

Latest commit

 

History

293 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlocSignal Logo

⚡ BlocSignal

"With the rigor of BLoC and the flex and speed of Signals"

A state management framework for Dart and Flutter that bridges the Business Logic Component (BLoC) pattern with Rody Davis's signals (v7) primitives.

CI Status License: MIT Style: very_good_analysis 100% Test Coverage

The BlocSignal monorepo consists of 10 modular packages:

Package Version Description
bloc_signals pub Core pure Dart reactive state primitives bridging BLoC & Signals
bloc_signals_flutter pub Flutter UI bindings, providers, builders, listeners & selectors
bloc_signals_jaspr pub Jaspr web component integration and state binding for BlocSignal
bloc_signals_riverpod pub Bidirectional Riverpod 2/3 interop adapters & provider extensions
bloc_signals_hydrate pub Automated synchronous local state persistence & hydration
bloc_signals_replay pub Undo & redo state history tracking for CubitSignal and BlocSignal
bloc_signals_otel pub OpenTelemetry tracing and span generation for state transitions
bloc_signals_devtools pub Universal DevTools telemetry observer using dart:developer
bloc_signals_test pub Declarative unit testing utilities (blocSignalTest)
bloc_signals_lint pub Custom analyzer lint rules & automated IDE quick-fixes

⚡ Key Features

  • 🚀 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 SignalModel integration on close.
  • 🔍 Global Observation: Hook in a BlocSignalObserver to easily log, trace, and monitor events and transitions globally.
  • 🔀 Automatic De-duplication: State transitions are automatically de-duplicated using standard == equality or custom equals.
  • 🛠️ 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.

📖 Background & Architecture References

BlocSignal combines two foundational pillars of the Dart & Flutter state management ecosystem:

Key Architectural Differences & Design Choices:

  • Synchronous vs. Asynchronous Emission: Unlike classic package:bloc which dispatches state changes on microtask-queue Streams, BlocSignal updates propagate synchronously. Calling emit(newState) triggers downstream calculations and widget rebuilds in the exact same frame.
  • 🔑 Named Constructor Initial State (initialState:): Constructors require the named parameter initialState: (for example, : super(initialState: 0)), unlike Felix BLoC's positional : super(0).
  • 📊 Explicit State Value Access (stateValue): Use stateValue (or state.value) to read raw StateType values in methods or event handlers (for example, emit(stateValue + 1)), while state exposes ReadonlySignal<StateType> for reactive signal bindings.
  • 🎯 context.select<B, R> 2-Argument Generic Signature: Unlike Riverpod (3 generic arguments) or classic flutter_bloc, context.select<B, R> takes 2 generic type parameters (<Bloc, SelectedType>) and passes the bloc instance directly to the callback: (bloc) => bloc.stateValue.property.
  • 📦 Zero RepositoryProvider Bloat: Dependency injection in BlocSignal is handled directly via BlocSignalProvider (or Riverpod/Jaspr context providers) without forcing a separate RepositoryProvider wrapper.
  • 🔒 Streamless Event Concurrency: Event concurrency transformers (droppable, sequential, restartable, Mutex) run via pure Dart higher-order functions without stream allocations or Rx dependencies.

📚 Documentation


🤖 AI Coding Assistant Skill & Plugin

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-plugin and .agents/plugins marketplace definitions.
  • Validation: Run dart run tool/validate_agent_plugin.dart to verify marketplace catalogs and skill bundle integrity.

📜 Credits & Acknowledgements

BlocSignal is heavily inspired by and builds upon the incredible work of:

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

40 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages