rx_bloc
6.0.1, released 2 years ago by primeholding.com
A BLoC design pattern implementation using reactive streams.
WASM-ready
What it does
Helps implement the BLoC design pattern using reactive streams from RxDart. It separates business logic from the UI layer via event and state contracts, with support for zero-boilerplate generation.
AI-written summary of version 6.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to implement the BLoC pattern using RxDart reactive streams
- You need a clear separation of events, states, and business logic
Skip it when
- You prefer simpler state management solutions like Provider
- You do not want to use reactive streams or RxDart
Strengths
- Strong decoupling of UI and business logic
- Built-in result handling for loading and error states
- Zero-boilerplate capabilities via code generation
Weaknesses
- Requires familiarity with RxDart and reactive programming
- Requires code generation setup for optimal usage
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Requires adding build_runner and rx_bloc_generator to dev_dependencies and running the code generator.
@RxBloc()
class CounterBloc extends $CounterBloc {
@override
Stream<int> _mapToCountState() => _$incrementEvent.map((_) => 1);
}Alternatives
Packages that do the same job and could replace rx_bloc.
Works with
Packages commonly used together with rx_bloc: ones it builds on, ones built on it, and its own family.
- rxdartrx_bloc depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- 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
- flutter_rx_blocBuilt on rx_blocFlutter widgets that implement the BLoC pattern using reactive streams with rx_bloc and rxdart.
- rx_bloc_listBuilt on rx_blocFacilitates infinite scroll and pull-to-refresh features for the RxBloc ecosystem.
- rx_bloc_generatorBuilt on rx_blocCode generator for rx_bloc that eliminates boilerplate code.
- rx_bloc_testBuilt on rx_blocEasily test rxBlocs and states from the FlutterRxBloc package.
- widget_toolkitBuilt on rx_blocThe Widget Toolkit package consists of several lightweight and customisable UI components that boost productivity and reduce the development time.