bloc_hooks 1.0.2 copy "bloc_hooks: ^1.0.2" to clipboard
bloc_hooks: ^1.0.2 copied to clipboard

The state management solution for Flutter, based on the BLoC pattern, with Hooks support.

Changelog #

1.0.2 #

  • Updated compatibility badges to Dart 3.10.8 and Flutter 3.38.9.

1.0.1 #

  • Polished the README with cleaner descriptions, specifically highlighting the simplified, in-place bloc injection and reduced boilerplate.

1.0.0 #

Initial release of bloc_hooks — a hooks-based integration for bloc state management with flutter_hooks.

Features #

Scope & Lifecycle

  • useBlocScope(factory) — Register a bloc factory for a widget subtree.
  • bindBloc<B, S>() — Create and bind a bloc to the current position in the widget tree; automatically disposed when the widget is removed.
  • useBloc<B>() — Retrieve the nearest bound bloc instance by walking up the widget tree.

State Hooks

  • useBlocWatch<S>() — Subscribe to full state changes with optional when filter; rebuilds the widget on every matching emission.
  • useBlocSelect<S, V>(selector) — Subscribe to a single derived value from the state; rebuilds only when the selected value changes.
  • useBlocListen<S>(listener) — React to state changes with side effects (dialogs, snack-bars, navigation) without rebuilding the widget.
  • useBlocRead<S>() — One-time, non-reactive read of the current state.

Effects

  • useBlocEffects<E>(handler) — Listen to one-shot effects dispatched from a bloc to the UI layer.
  • Effects<E> mixin — Add effect emission capability to any Cubit or Bloc.
0
likes
160
points
169
downloads

Documentation

API reference

Publisher

verified publisheryhdart.com

Weekly Downloads

The state management solution for Flutter, based on the BLoC pattern, with Hooks support.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

bloc, flutter, flutter_hooks

More

Packages that depend on bloc_hooks