riverpod_annotation
4.0.8, released 14 days ago by dash-overflow.net
Annotations for riverpod_generator to enable code generation
What it does
Provides annotations used by riverpod_generator to generate Riverpod providers. It contains only annotation classes and no runtime logic.
AI-written summary of version 4.0.8, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using riverpod_generator for code generation
- You want to keep provider definitions concise and type-safe
Skip it when
- You are not using riverpod_generator or prefer manual provider definitions
Strengths
- No runtime overhead
- Keeps annotations separate from logic
- Supports Dart 3.7+
Weaknesses
- Only works with riverpod_generator
- Requires build_runner
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Add riverpod_annotation and riverpod_generator to dev_dependencies and run build_runner
@Riverpod
Future<int> counter(CounterRef ref) async {
return 0;
}Alternatives
Packages that do the same job and could replace riverpod_annotation.
- mobx_codegen
Generates MobX store boilerplate from @observable, @computed and @action annotations.
85Compare - widgetbook_annotation
Annotations for widgetbook_generator to build Flutter widgets in isolation.
80Compare - build
Package for authoring build_runner compatible code generators.
87Compare - drift_dev
Generates Dart database code from Drift table definitions as a dev‑dependency.
84Compare
Works with
Packages commonly used together with riverpod_annotation: ones it builds on, ones built on it, and its own family.
- riverpodriverpod_annotation depends on itA reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
- flutter_riverpodSame familyA reactive caching and data-binding framework for Flutter.
- hooks_riverpodSame familyA reactive caching, data-binding, and state management framework with flutter_hooks integration.
- riverpod_generatorBuilt on riverpod_annotationGenerates Riverpod providers from annotated functions using build_runner.
- colorist_uiBuilt on riverpod_annotationA Flutter library of UI components for an LLM codelab.