avoid_ renaming_ method_ parameters
Learn about the avoid_renaming_method_parameters linter rule.
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:
abstract class A {
m(a);
}
abstract class B extends A {
m(b);
}
GOOD:
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:
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:
linter:
rules:
avoid_renaming_method_parameters: true
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.