enum_constant_same_name_as_enclosing
Details about the 'enum_constant_same_name_as_enclosing' diagnostic produced by the Dart analyzer.
The name of the enum value can't be the same as the enum's name.
Description
#The analyzer produces this diagnostic when an enum value has the same name as the enum in which it's declared.
Example
#
The following code produces this diagnostic because the enum value 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
}
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.