super_in_extension_type
The 'super' keyword can't be used in an extension type because an extension type doesn't have a superclass.
Description
#The analyzer produces this diagnostic when super
is used in an instance
member of an extension type. Extension types don't have superclasses, so
there's no inherited member that could be invoked.
Example
#The following code produces this diagnostic because :
dart
extension type E(String s) {
void m() {
super.m();
}
}
Common fixes
#Replace or remove the super
invocation:
dart
extension type E(String s) {
void m() {
s.toLowerCase();
}
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。