Skip to content

use_notifier_suffix

v0.1.0 Warning Class Naming

This rule flags classes that extend Notifier (or AsyncNotifier) but don’t include the Notifier suffix in their name. Consistent naming makes it immediately clear which classes are Riverpod Notifiers when scanning through your codebase.

Riverpod Notifiers have a specific lifecycle and behavior — they’re created by providers, have a build() method, and manage reactive state. When a class like CounterManager extends Notifier without the suffix, developers have to inspect the class to understand its role. The Notifier suffix makes the architectural intent obvious.

See also: Riverpod Notifier documentation

import 'package:riverpod/riverpod.dart';
// Missing 'Notifier' suffix
class CounterManager extends Notifier<int> {
@override
int build() => 0;
void increment() => state++;
}
import 'package:riverpod/riverpod.dart';
class CounterNotifier extends Notifier<int> {
@override
int build() => 0;
void increment() => state++;
}

To disable this rule:

plugins:
many_lints:
diagnostics:
use_notifier_suffix: false