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:
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.7.3. Page last updated on 2025-05-08. View source or report an issue.