extension_ type_ constructor_ with_ super_ formal_ parameter
Details about the 'extension_type_constructor_with_super_formal_parameter' diagnostic produced by the Dart analyzer.
Extension type constructors can't declare super formal parameters.
Description
#The analyzer produces this diagnostic when a constructor in an extension type has a super parameter. Super parameters aren't valid because extension types don't have a superclass.
Example
#
The following code produces this diagnostic because the named constructor
n contains a super parameter:
extension type E(int i) {
E.n(this.i, super.foo);
}
Common fixes
#If you need the parameter, replace the super parameter with a normal parameter:
extension type E(int i) {
E.n(this.i, String foo);
}
If you don't need the parameter, remove the super parameter:
extension type E(int i) {
E.n(this.i);
}
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Report an issue.