notifier_build
v0.8.0 Warning Fix Riverpod State
Flags a class annotated with @riverpod (or @Riverpod(...)) that has no build method.
Why use this rule
Section titled “Why use this rule”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
@riverpodclass Counter extends _$Counter {} // LINT@riverpodclass Counter extends _$Counter { @override int build() => 0;}Functional providers are not affected — they have no build method by design:
@riverpodint counter(Ref ref) => 0;Configuration
Section titled “Configuration”This rule is in the core preset, so it is on with preset: core,
preset: recommended or preset: opinionated.
To turn it off:
rules: notifier_build: falseTo keep the rule on but skip certain paths, use per-rule exclude.
Related rules
Section titled “Related rules”protected_notifier_properties— A Notifier’s state, ref and future should not be used from outside the notifier.avoid_notifier_constructors— Prevent initialization logic in Notifier constructors.avoid_public_notifier_properties— Prevent public fields, getters, and setters on Notifier classes.avoid_build_context_in_providers— Providers outlive widgets, so they should not receive a BuildContext.