extension_type_implements_not_supertype
'{0}' is not a supertype of '{1}', the representation type.
Description
#The analyzer produces this diagnostic when an extension type implements a type that isn't a supertype of the representation type.
Example
#The following code produces this diagnostic because the extension type A
implements String
, but String
isn't a supertype of the representation
type int
:
dart
extension type A(int i) implements String {}
Common fixes
#If the representation type is correct, then remove or replace the type in the implements clause:
dart
extension type A(int i) {}
If the representation type isn't correct, then replace it with the correct type:
dart
extension type A(String s) implements String {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。