extension_type_constructor_with_super_invocation
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:
dart
extension type E(int i) {
E.n() : i = 0, super.n();
}
Common fixes
#Remove the invocation of the super constructor:
dart
extension type E(int i) {
E.n() : i = 0;
}
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.