extension_ type_ constructor_ with_ super_ invocation
Details about the 'extension_type_constructor_with_super_invocation' diagnostic produced by the Dart analyzer.
Extension type constructors can't include super initializers.
Description
#The analyzer produces this diagnostic when a constructor in an extension type includes an invocation of a super constructor in the initializer list. Because extension types don't have a superclass, there's no constructor to invoke.
Example
#
The following code produces this diagnostic because the
constructor E.n
invokes a super constructor in its initializer list:
extension type E(int i) {
E.n() : i = 0, super.n();
}
Common fixes
#Remove the invocation of the super constructor:
extension type E(int i) {
E.n() : i = 0;
}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.