Dart Analyze logoDart Analyze/
DRT-W1323

The name of the enum constant can't be the same as the enum's nameDRT-W1323

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when an enum constant has the same name as the enum in which it's declared.

Example

The following code produces this diagnostic because the enum constant E has the same name as the enclosing enum E:

enum E {
  E
}

Common fixes

If the name of the enum is correct, then rename the constant:

enum E {
  e
}

If the name of the constant is correct, then rename the enum:

enum F {
  E
}