flutter_rx_bloc
7.0.0, released 2 years ago by primeholding.com
Flutter widgets that implement the BLoC pattern using reactive streams with rx_bloc and rxdart.
What it does
Provides a set of Flutter widgets like RxBlocBuilder, RxResultBuilder, and RxBlocProvider to easily integrate reactive BLoC state management into your widget tree. It handles bloc lifecycle, dependency injection, and building UI in response to stream updates.
AI-written summary of version 7.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using the rx_bloc and rxdart architecture in your Flutter application.
- You want concise reactive UI builders like RxBlocBuilder and RxResultBuilder without excessive boilerplate.
- You need dependency injection and scoping for your blocs via RxBlocProvider.
Skip it when
- You prefer the bloc and flutter_bloc packages instead of rx_bloc.
- You are not using reactive streams or RxDart for your state management.
Strengths
- Simplifies stream-based UI updates with clean widget builders.
- Built-in handling of Result states via RxResultBuilder.
- Seamless integration with RxBlocProvider for DI and bloc scoping.
Weaknesses
- Strictly tied to the rx_bloc and rxdart ecosystem.
- Requires learning the specific rx_bloc patterns and contracts.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add flutter_rx_bloc, rx_bloc, and rxdart to your pubspec.yaml dependencies.
RxBlocBuilder<NewsBlocType, List<News>>(
state: (bloc) => bloc.states.news,
builder: (context, state, bloc) {
return ListView.builder(
itemCount: state.length,
itemBuilder: (context, index) => Text(state[index].toString()),
);
},
)Alternatives
Packages that do the same job and could replace flutter_rx_bloc.
- flutter_bloc
If you want to use the standard Bloc library instead of the reactive rx_bloc ecosystem.
86Compare - flutter_riverpod
If you want a modern, compile-safe state management solution without traditional blocs.
93Compare
Works with
Packages commonly used together with flutter_rx_bloc: ones it builds on, ones built on it, and its own family.
- rxdartflutter_rx_bloc depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- providerflutter_rx_bloc depends on itA lightweight wrapper around InheritedWidget for state management
- rx_blocflutter_rx_bloc depends on itA BLoC design pattern implementation using reactive streams.
- rx_bloc_generatorSame familyCode generator for rx_bloc that eliminates boilerplate code.
- rx_bloc_testSame familyEasily test rxBlocs and states from the FlutterRxBloc package.
- rx_bloc_cliSame familyrx_bloc_cli that enables quick project setup including: flavors, localization [intl], state management [rx_bloc], routing [go_router], design system, analytics [firebase], tests
- rx_bloc_listBuilt on flutter_rx_blocFacilitates infinite scroll and pull-to-refresh features for the RxBloc ecosystem.
- widget_toolkitBuilt on flutter_rx_blocThe Widget Toolkit package consists of several lightweight and customisable UI components that boost productivity and reduce the development time.