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) {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。