enum_with_abstract_member
'{0}' must have a method body because '{1}' is an enum.
Description
#The analyzer produces this diagnostic when a member of an enum is found that doesn't have a concrete implementation. Enums aren't allowed to contain abstract members.
Example
#The following code produces this diagnostic because m
is an abstract method and E
is an enum:
dart
enum E {
e;
void m();
}
Common fixes
#Provide an implementation for the member:
dart
enum E {
e;
void m() {}
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.