avoid-public-notifier-properties
Warns when a Notifier
or AsyncNotifier
has a public state outside of the state
property.
Example
❌ Bad:
class MyNotifier extends Notifier<int> {
int get _privateGetter => 0;
// LINT: Avoid creating public properties for notifiers.
// Try moving them to the 'state' property.
int get publicGetter => _privateGetter;
int build() => 0;
}
✅ Good:
class MyState {
final int left;
final int right;
MyState(this.left, this.right);
}
class MyNotifier extends Notifier<MyState> {
int build() => MyState(0, 1);
}