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
:
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:
extension type A(int i) {}
If the representation type isn't correct, then replace it with the correct type:
extension type A(String s) implements String {}
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.