extension_type_representation_depends_on_itself
The extension type representation can't depend on itself.
Description
#The analyzer produces this diagnostic when an extension type has a representation type that depends on the extension type itself, either directly or indirectly.
Example
#The following code produces this diagnostic because the representation
type of the extension type A
depends on A
directly:
extension type A(A a) {}
The following two code examples produce this diagnostic because the
representation type of the extension type A
depends on A
indirectly through the extension type B
:
extension type A(B b) {}
extension type B(A a) {}
extension type A(List<B> b) {}
extension type B(List<A> a) {}
Common fixes
#Remove the dependency by choosing a different representation type for at least one of the types in the cycle:
extension type A(String s) {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。