prefer-riverpod-provider-suffix
Suggests ending Provider variable names with the Provider suffix.
⚙️ Config
Set banned-suffixes (default is [NotifierProvider]) to configure a list of banned suffixes.
analysis_options.yaml
dcm:
rules:
- prefer-riverpod-provider-suffix:
banned-suffixes:
- NotifierProvider
Example
❌ Bad:
// LINT: The name of this provider variable should end with Provider.
// Try renaming this variable.
final first = Provider((ref) {
final instance = DisposableService();
ref.onCancel(instance.dispose);
return instance;
});
// LINT: The name of this provider variable ends with one of the banned suffixes.
// Try renaming this variable.
final firstNotifierProvider = Provider((ref) {
final instance = DisposableService();
ref.onCancel(instance.dispose);
return instance;
});
✅ Good:
final firstProvider = Provider((ref) {
final instance = DisposableService();
ref.onCancel(instance.dispose);
return instance;
});
final secondProvider = Provider((ref) {
final instance = DisposableService();
ref.onCancel(instance.dispose);
return instance;
});