rx_bloc_test
5.0.0, released 2 years ago by primeholding.com
Easily test rxBlocs and states from the FlutterRxBloc package.
WASM-ready
What it does
Provides testing utilities such as rxBlocTest and rxBlocFakeAsyncTest to write unit tests for RxBloc implementations with ease. It allows verifying emitted states, acting on bloc events, skipping initial values, and handling asynchronous code using FakeAsync.
AI-written summary of version 5.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using rx_bloc and flutter_rx_bloc for state management and need to write unit tests for your blocs.
- You need to test complex blocs featuring debounce or throttle operations using fake async.
Skip it when
- You are using a different state management solution such as Riverpod or standard Bloc.
- You do not use RxBloc in your architecture.
Strengths
- Simplifies testing of RxBloc streams and states.
- Supports fake async execution to speed up tests involving throttle or debounce time.
Weaknesses
- Strictly coupled to the rx_bloc ecosystem.
- Limited documentation outside of README examples.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
rxBlocTest<CounterBloc,int>(
'Emits [] when created',
build: () async => CounterBloc(),
state: (bloc) => bloc.states.count,
expect: [],
);Alternatives
Packages that do the same job and could replace rx_bloc_test.
Works with
Packages commonly used together with rx_bloc_test: ones it builds on, ones built on it, and its own family.
- testrx_bloc_test depends on itA full featured library for writing and running Dart tests across platforms.
- fake_asyncrx_bloc_test depends on itFake asynchronous events like timers and microtasks for deterministic testing.
- rxdartrx_bloc_test depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- rx_blocrx_bloc_test depends on itA BLoC design pattern implementation using reactive streams.
- flutter_rx_blocSame familyFlutter widgets that implement the BLoC pattern using reactive streams with rx_bloc and rxdart.
- rx_bloc_listSame familyFacilitates infinite scroll and pull-to-refresh features for the RxBloc ecosystem.
- rx_bloc_generatorSame familyCode generator for rx_bloc that eliminates boilerplate code.
- 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