avoid_redundant_argument_values

Group: style

Maturity: stable

Dart SDK: >= 2.8.1 • (Linter v0.1.107)

Since info is static, may be stale
has-fix

View all Lint Rules

Using the Linter

DON'T pass an argument that matches the corresponding parameter's default value.

BAD:

void f({bool valWithDefault = true, bool? val}) {
  ...
}

void main() {
  f(valWithDefault: true);
}

GOOD:

void f({bool valWithDefault = true, bool? val}) {
  ...
}

void main() {
  f(valWithDefault: false);
  f();
}

Usage

To enable the avoid_redundant_argument_values lint, add avoid_redundant_argument_values under linter > rules in your analysis_options.yaml file:

linter:
  rules:
    - avoid_redundant_argument_values