riverpod_test
0.1.9, released 2 years ago by eronsoft.com
A testing library for easily testing Riverpod providers.
What it does
It provides helper functions like testProvider, testNotifier, and testAsyncNotifier to simplify testing Riverpod providers and notifiers. It allows you to specify actions, expected state emissions, and verification steps.
AI-written summary of version 0.1.9, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using Riverpod for state management and want to write unit tests for your providers.
- You want to test state changes, async values, and notifiers emitted by Riverpod.
Skip it when
- Your project does not use Riverpod.
- You prefer writing standard Dart test blocks without specialized testing wrappers.
Strengths
- Simplifies testing of various Riverpod provider types including Notifier, AsyncNotifier, and StateNotifier.
- Port of bloc_test which makes it familiar for developers coming from the BLoC library.
Weaknesses
- Tightly coupled to the Riverpod state management library.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add the package to your dev_dependencies.
testProvider(
'expect [0]',
provider: counterProvider,
expect: () => [0],
);
final counterProvider = Provider<int>((ref) => 0);Alternatives
Packages that do the same job and could replace riverpod_test.
- bloc_test
A testing library that makes it easy to test blocs and cubits.
82Compare - provider_test
A testing library which makes it easy to test providers.
64Compare - elementary_test
Testing library for apps built with the Elementary architecture.
68Compare - flutter_svg_test
A testing library for finding and verifying flutter_svg images in widget tests.
66Compare
Works with
Packages commonly used together with riverpod_test: ones it builds on, ones built on it, and its own family.
- testriverpod_test depends on itA full featured library for writing and running Dart tests across platforms.
- riverpodriverpod_test depends on itA reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
- diff_match_patchriverpod_test depends on itDart library implementing diff, match and patch algorithms for plain text.