extension_ type_ implements_ representation_ not_ supertype
'{0}', the representation type of '{1}', is not a supertype of '{2}', the representation type of '{3}'.
Description
#The analyzer produces this diagnostic when an extension type implements another extension type, and the representation type of the implemented extension type isn't a subtype of the representation type of the implementing extension type.
Example
#
The following code produces this diagnostic because the extension type B
implements A, but the representation type of A (num) isn't a
subtype of the representation type of B (String):
extension type A(num i) {}
extension type B(String s) implements A {}
Common fixes
#Either change the representation types of the two extension types so that the representation type of the implemented type is a supertype of the representation type of the implementing type:
extension type A(num i) {}
extension type B(int n) implements A {}
Or remove the implemented type from the implements clause:
extension type A(num i) {}
extension type B(String s) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.