extension_type_implements_itself
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:
dart
extension type A(int i) implements A {}
The following code produces this diagnostic because the extension type A
indirectly implements itself (through B
):
dart
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:
dart
extension type A(int i) implements B {}
extension type B(int 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.