Skip to content
pubscout

rx_bloc_test

5.0.0, released 2 years ago by primeholding.com

Easily test rxBlocs and states from the FlutterRxBloc package.

WASM-ready
$ flutter pub add rx_bloc_test
Source repository

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.

  • bloc_test

    If you are using standard bloc/flutter_bloc instead of rx_bloc.

Works with

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