avoid-unused-parameters
added in: 2.4.0
warning
Checks for unused parameters inside a function or method body. For overridden methods suggests renaming unused parameters to _, __, etc.
caution
Abstract classes are completely ignored by the rule to avoid redundant checks for potentially overridden methods.
info
The fix for this rule is available only in "Teams" version.
Example
❌ Bad:
void someFunction(String s) { // LINT
return;
}
class SomeClass {
void method(String s) { // LINT
return;
}
}
class SomeClass extends AnotherClass {
void method(String s) {} // LINT
}
✅ Good:
void someOtherFunction() {
return;
}
class SomeOtherClass {
void method() {
return;
}
}
void someOtherFunction(String s) {
print(s);
return;
}
class SomeOtherClass {
void method(String s) {
print(s);
return;
}
}
class SomeOtherClass extends AnotherClass {
void method(String _) {}
}
abstract class SomeOtherClass {
void method(String s);
}