avoid_redundant_pattern_field_names

SeverityQuick FixOptions
Info

Details

DO avoid redundant pattern field names when it can be inferred.

Bad
void fn(Map<String, int> map) {
  for (final MapEntry(key: key, value: value) in map.entries) {}
}
Good
void fn(Map<String, int> map) {
  for (final MapEntry(:key, :value) in map.entries) {}
}

Usage

To enable the avoid_redundant_pattern_field_names rule, add avoid_redundant_pattern_field_names under custom_lint > rules in your analysis_options.yaml file:

custom_lint:
  rules:
    - avoid_redundant_pattern_field_names