avoid-always-null-parameters
Warns when a private function or method has a parameter that always gets null.
Such parameters can be removed.
note
This rule handles only private declarations. For public functions and methods use the check-parameters command.
Example
❌ Bad:
class Some {
void work() {
_fn(null);
}
// LINT: This parameter always gets a null value. Try removing it.
void _fn(String? nullable) {
if (nullable == null) {
// handle nullable case
} else {
// handle regular case
}
}
}
✅ Good:
class Some {
void work() {
_fn();
}
void _fn() {
// handle nullable case
}
}