non_final_field_in_enum
Details about the 'non_final_field_in_enum' diagnostic produced by the Dart analyzer.
Enums can only declare final fields.
Description
#
The analyzer produces this diagnostic when an instance field in an enum
isn't marked as final.
Example
#
The following code produces this diagnostic because the field f isn't a
final field:
enum E {
c;
int f = 0;
}
Common fixes
#
If the field must be defined for the enum, then mark the field as being
final:
enum E {
c;
final int f = 0;
}
If the field can be removed, then remove it:
enum E {
c
}
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.