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.
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.
- flutter_bloc
Official and widely adopted package for the Bloc pattern.
86Compare - riverpod
Modern, compile-safe dependency injection and state management solution.
99Compare
Works with
Packages commonly used together with flutter_bloc_pattern: ones it builds on, ones built on it, and its own family.
- rxdart_extflutter_bloc_pattern depends on itExtension methods and classes built on top of RxDart like Single and StateStream.
- flutter_providerflutter_bloc_pattern depends on itA lightweight generic provider using InheritedWidget to expose values in Flutter.
- flutter_google_places_hoc081098Built on flutter_bloc_patternGoogle Places autocomplete widgets for Flutter