Skip to main content

avoid-notifier-constructors

added in: 1.19.0
Pro+

Warns when a Notifier (or AsyncNotifier) has a non-empty constructor.

Example

❌ Bad:

class Counter extends Notifier<int> {
var state = 0;

// LINT
Counter() {
state = 1;
}


int build() {
return state;
}

void increment() {
state++;
}
}

✅ Good:

class Counter extends Notifier<int> {

int build() {
return 0;
}

void increment() {
state++;
}
}