avoid_renaming_method_parameters
Don't rename parameters of overridden methods.
This rule is available as of Dart 2.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:
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);
}
Usage
#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
除非另有说明,文档之所提及适用于 Dart 3.5.4 版本,本页面最后更新时间: 2024-08-02。 查看文档源码 或者 报告页面问题。