Skip to main content

avoid-never-passed-parameters

effort: 2m
teams+

Warns when a private function or method has an optional parameter that never gets a value.

Never passed parameters are usually a sign of incomplete implementation or a refactoring leftover. Consider either passing a value to such parameters or removing them from the declaration.

note

This rule handles only private declarations. For public functions and methods use the check-parameters command.

Example

❌ Bad:

class Some {
void work() {
_fn();
}

// LINT: This parameter never gets a 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 regular case
}
}