super_ in_ redirecting_ constructor
Details about the 'super_in_redirecting_constructor' diagnostic produced by the Dart analyzer.
The redirecting constructor can't have a 'super' initializer.
Description
#The analyzer produces this diagnostic when a constructor that redirects to another constructor also attempts to invoke a constructor from the superclass. The superclass constructor will be invoked when the constructor that the redirecting constructor is redirected to is invoked.
Example
#
The following code produces this diagnostic because the
constructor C.a both redirects to
C.b and invokes a constructor from the
superclass:
class C {
C.a() : this.b(), super();
C.b();
}
Common fixes
#
Remove the invocation of the super constructor:
class C {
C.a() : this.b();
C.b();
}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.