undefined_ super_ member
Details about the 'undefined_super_member' diagnostic produced by the Dart analyzer.
(Previously known as
undefined_super_method.)
The getter '{0}' isn't defined in a superclass of '{1}'.
The method '{0}' isn't defined in a superclass of '{1}'.
The operator '{0}' isn't defined in a superclass of '{1}'.
The setter '{0}' isn't defined in a superclass of '{1}'.
Description
#
The analyzer produces this diagnostic when an inherited member
(method, getter, setter, or operator) is referenced using
super, but there's no member with that name in
the superclass chain.
Examples
#
The following code produces this diagnostic because
Object doesn't define a method named
n:
class C {
void m() {
super.n();
}
}
The following code produces this diagnostic because
Object doesn't define a getter named
g:
class C {
void m() {
super.g;
}
}
Common fixes
#If the inherited member you intend to invoke has a different name, then make the name of the invoked member match the inherited member.
If the member you intend to invoke is defined in the same
class, then remove the super..
If the member isn't defined, then either add the member to one of the superclasses or remove the invocation.
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.