Skip to main content

prefer-single-notifier-per-file

effort: 4m
pro+

Suggests keeping only one Notifier per file.

Example

❌ Bad:

class Some extends Notifier<int> {
final int field = 0;


int build() => 0;
}

// LINT: Prefer only one Notifier per file. Try moving this Notifier to a separate file.
class Another extends Notifier<int> {

int get state;


int build() => 0;
}

✅ Good:

some_notifier.dart
class Some extends Notifier<int> {
final int field = 0;


int build() => 0;
}
another_notifier.dart
class Another extends Notifier<int> {

int get state;


int build() => 0;
}