avoid_renaming_method_parameters
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
Unless stated otherwise, the documentation on this site reflects Dart 3.6.0. Page last updated on 2025-01-27. View source or report an issue.