extension_ type_ implements_ itself
Details about the 'extension_type_implements_itself' diagnostic produced by the Dart analyzer.
The extension type can't implement itself.
Description
#The analyzer produces this diagnostic when an extension type implements itself, either directly or indirectly.
Example
#
The following code produces this diagnostic because the extension type A
directly implements itself:
extension type A(int i) implements A {}
The following code produces this diagnostic because the extension type A
indirectly implements itself (through B):
extension type A(int i) implements B {}
extension type B(int i) implements A {}
Common fixes
#Break the cycle by removing a type from the implements clause of at least one of the types involved in the cycle:
extension type A(int i) implements B {}
extension type B(int i) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Report an issue.