Skip to content
pubscout

flutter_bloc_pattern

3.0.0, released 2 years ago by an unverified publisher

Provides BLoCs to descendant widgets with internal disposal and RxDart stream builders.

WASM-ready
$ flutter pub add flutter_bloc_pattern
Source repository

What it does

Provides BLoC instances to descendant widgets in O(1) time and automatically disposes them when unmounted using an internal state holder. It also includes an RxDart-compatible stream builder widget.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building BLoCs using RxDart and need an efficient widget-tree provider and stream builder.
  • You want automatic disposal of BLoC instances tied to the provider's lifecycle.

Skip it when

  • you are using the official `flutter_bloc` package instead of custom RxDart BLoCs.
  • you prefer a modern state management solution like Riverpod.

Strengths

  • O(1) BLoC lookup via context extension or BlocProvider
  • Automatic disposal of BLoCs
  • Built-in RxStreamBuilder support for handling streams and value streams

Weaknesses

  • Tied specifically to RxDart-based BLoC patterns rather than the official bloc library
  • Limited ecosystem compared to official bloc or riverpod

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

not documented

final bloc = BlocProvider.of<MyBloc>(context);
return RxStreamBuilder<String>(
  stream: bloc.stream,
  builder: (context, state) {
    return Text('$state');
  },
);

Alternatives

Packages that do the same job and could replace flutter_bloc_pattern.

Works with

Packages commonly used together with flutter_bloc_pattern: ones it builds on, ones built on it, and its own family.