avoid_redundant_argument_values
Avoid redundant argument values.
This rule is available as of Dart 2.8.1.
This rule has a quick fix available.
Details
#DON'T pass an argument that matches the corresponding parameter's default value.
BAD:
dart
void f({bool valWithDefault = true, bool? val}) {
...
}
void main() {
f(valWithDefault: true);
}
GOOD:
dart
void f({bool valWithDefault = true, bool? val}) {
...
}
void main() {
f(valWithDefault: false);
f();
}
Usage
#To enable the avoid_redundant_argument_values
rule,
add avoid_redundant_argument_values
under linter > rules in your
analysis_options.yaml
file:
analysis_options.yaml
yaml
linter:
rules:
- avoid_redundant_argument_values
除非另有说明,文档之所提及适用于 Dart 3.5.0 版本,本页面最后更新时间: 2024-09-09。 查看文档源码 或者 报告页面问题。