Skip to content

notifier_build

v0.8.0 Warning Fix Riverpod State

Flags a class annotated with @riverpod (or @Riverpod(...)) that has no build method.

The generator turns a notifier’s build method into the provider’s create function. Without one, the build step fails — and the error points at the generated file, not the class that caused it. Catching this at analysis time names the actual class and offers a stub.

See also: Riverpod - Code generation

@riverpod
class Counter extends _$Counter {} // LINT
@riverpod
class Counter extends _$Counter {
@override
int build() => 0;
}

Functional providers are not affected — they have no build method by design:

@riverpod
int counter(Ref ref) => 0;

This rule is in the core preset, so it is on with preset: core, preset: recommended or preset: opinionated.

To turn it off:

many_lints.yaml
rules:
notifier_build: false

To keep the rule on but skip certain paths, use per-rule exclude.