extension_type_with_abstract_member
'{0}' must have a method body because '{1}' is an extension type.
Description
#The analyzer produces this diagnostic when an extension type declares an abstract member. Because extension type member references are resolved statically, an abstract member in an extension type could never be executed.
Example
#The following code produces this diagnostic because the method m
in the extension type E
is abstract:
extension type E(String s) {
void m();
}
Common fixes
#If the member is intended to be executable, then provide an implementation of the member:
extension type E(String s) {
void m() {}
}
If the member isn't intended to be executable, then remove it:
extension type E(String s) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.