extension_type_constructor_with_super_formal_parameter
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:
dart
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:
dart
extension type E(int i) {
E.n(this.i, String foo);
}
If you don't need the parameter, remove the super parameter:
dart
extension type E(int i) {
E.n(this.i);
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.