Contents
Contents

Don't rename parameters of overridden methods.

This rule is available as of Dart 2.0.0.

Rule sets: recommended, flutter

This rule has a quick fix available.

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);
}

Usage

#

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