type_ argument_ not_ matching_ bounds
'{0}' doesn't conform to the bound '{1}' of the type parameter '{2}'.
Description
#The analyzer produces this diagnostic when a type argument isn't the same as or a subclass of the bounds of the corresponding type parameter.
Example
#
The following code produces this diagnostic because
String
isn't a
subclass of
num
:
class A<E extends num> {}
var a = A<String>();
Common fixes
#Change the type argument to be a subclass of the bounds:
class A<E extends num> {}
var a = A<int>();
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.