avoid-renaming-method-parameters
Same as avoid_renaming_method_parameters in Dart lints
- Group
- Style
- Path
lint/style/avoid-renaming-method-parameters- Default
- Off, opt in
- Origin
- Dart lints
- Rule
- 129 of 512
Requires overriding methods to keep the positional parameter names of the member they inherit.
The rule only runs for libraries under the package's lib/ directory and skips
static and documented methods. For a class, enum, or mixin class the
compared member is the concrete one inherited through the superclass chain
and mixin applications (abstract and implements-only members do not
count); for a mixin it is the member of its on types' interfaces (or
Object). Owners with private names, extension types, getters, and setters
are never checked. Positional parameters are compared pairwise up to the
shorter list.
A _ name on either side is skipped when the library's language version
enables wildcard variables (3.7+).
Invalid
abstract class AbstractBase {
void abstractOnly(int value);
}
class ConcreteBase {
void concrete(int value, int other) {}
bool operator ==(Object other) => false;
}
abstract class FromAbstract extends AbstractBase {
// Only an abstract member is inherited: no concrete parent.
@override
void abstractOnly(int renamed);
}
class FromInterface implements ConcreteBase {
@override
void concrete(int renamed, int other) {}
}
class Shorter extends ConcreteBase {
@override
void concrete(int renamed) {}
}
class Documented extends ConcreteBase {
/// Documented overrides are exempt.
@override
void concrete(int a, int b) {}
}
class _Private extends ConcreteBase {
@override
void concrete(int a, int b) {}
}
mixin OnBase on AbstractBase {
@override
void abstractOnly(int renamed) {}
} @override void concrete(int renamed) {} @override void abstractOnly(int renamed) {}Valid
class Base { void method(int value) {} }
class Child extends Base { void method(int value) {} }Configure avoid-renaming-method-parameters
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"avoid-renaming-method-parameters": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/avoid-renaming-method-parameters: <reason>More style rules
- avoid-return-types-on-setters
avoid_return_types_on_settersrecommendedFlags setters declared with an explicit return type.
- avoid-returning-this
avoid_returning_thisFlags methods that return
thisonly to enable a fluent interface. - avoid-setters-without-getters
avoid_setters_without_gettersFlags a setter that has no corresponding getter.
- avoid-single-cascade-in-expression-statements
avoid_single_cascade_in_expression_statementsrecommendedFlags an expression statement that is a cascade with a single section.
- avoid-single-child-column-or-row
avoid_single_child_column_or_rowflutterFlags a
Column,Row, orFlexwidget built with a single child. - avoid-top-level-member-access
Flags mutable global state: non-
const, non-finaltop-level variables and static fields, plus every read of mutable top-level variables. - avoid-types-on-closure-parameters
avoid_types_on_closure_parametersFlags type annotations on closure parameters whose types come from context.
- avoid-unnecessary-block
Flags standalone nested blocks that introduce no lexical declarations.