Dart Analyze logoDart Analyze/
DRT-W1336

Expected two map pattern type argumentsDRT-W1336

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a map pattern has either one type argument or more than two type arguments. Map patterns can have either two type arguments or zero type arguments, but can't have any other number.

Example

The following code produces this diagnostic because the map pattern (<int>{}) has one type argument:

void f(Object x) {
  if (x case <int>{0: _}) {}
}

Common fixes

Add or remove type arguments until there are two, or none:

void f(Object x) {
  if (x case <int, int>{0: _}) {}
}