Dart Analyze logoDart Analyze/
DRT-W1337

Invalid number of type arguments in map literalDRT-W1337

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a map literal has either one or more than two type arguments.

Example

The following code produces this diagnostic because the map literal has three type arguments when it can have either two or zero:

var m = <int, String, int>{};

Common fixes

Remove all except two of the type arguments:

var m = <int, String>{};