type_ argument_ not_ matching_ bounds
Details about the 'type_argument_not_matching_bounds' diagnostic produced by the Dart analyzer.
'{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.10.3. Report an issue.