avoid_renaming_method_parameters

Stable
Recommended
Fix available

Don't rename parameters of overridden methods.

Details

#

DON'T rename parameters of overridden methods.

Methods that override another method, but do not have their own documentation comment, will inherit the overridden method's comment when dart doc produces documentation. If the inherited method contains the name of the parameter (in square brackets), then dart doc cannot link it correctly.

BAD:

dart
abstract class A {
  m(a);
}

abstract class B extends A {
  m(b);
}

GOOD:

dart
abstract class A {
  m(a);
}

abstract class B extends A {
  m(a);
}

Enable

#

To enable the avoid_renaming_method_parameters rule, add avoid_renaming_method_parameters under linter > rules in your analysis_options.yaml file:

analysis_options.yaml
yaml
linter:
  rules:
    - avoid_renaming_method_parameters

If you're instead using the YAML map syntax to configure linter rules, add avoid_renaming_method_parameters: true under linter > rules:

analysis_options.yaml
yaml
linter:
  rules:
    avoid_renaming_method_parameters: true