Skip to content

Suggestion: add @optionalTypeArgs to MapEntry #55709

@nate-thegrate

Description

@nate-thegrate

Pattern-matching with MapEntry is very satisfying, but when always_specify_types is on, it's kinda awful.

final List<String> list = <String>[
  for (final MapEntry<KeyClass, ValueClassWithAVeryLongName>(:KeyClass key, :ValueClassWithAVeryLongName value) in map.entries)
    '$key, $value',
];

I'd much prefer not needing to add the type parameters here:

final List<String> list = <String>[
  for (final MapEntry(:KeyClass key, :ValueClassWithAVeryLongName value) in map.entries)
    '$key, $value',
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagedevexp-pkg-metaIssues related to package:metatype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions