Skip to content
pubscout

riverpod_annotation

4.0.8, released 14 days ago by dash-overflow.net

Annotations for riverpod_generator to enable code generation

WASM-ready
$ flutter pub add riverpod_annotation
Source repository

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.

  • widgetbook_annotation

    Annotations for widgetbook_generator to build Flutter widgets in isolation.

  • build

    Package for authoring build_runner compatible code generators.

  • drift_dev

    Generates Dart database code from Drift table definitions as a dev‑dependency.

Works with

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