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:
dart
extension type E(String s) {
void m();
}
Common fixes
#If the member is intended to be executable, then provide an implementation of the member:
dart
extension type E(String s) {
void m() {}
}
If the member isn't intended to be executable, then remove it:
dart
extension type E(String s) {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。