supertype_expands_to_type_parameter
A type alias that expands to a type parameter can't be implemented.
A type alias that expands to a type parameter can't be mixed in.
A type alias that expands to a type parameter can't be used as a superclass constraint.
A type alias that expands to a type parameter can't be used as a superclass.
Description
#The analyzer produces this diagnostic when a type alias that expands to a
type parameter is used in an extends
, implements
, with
, or on
clause.
Example
#The following code produces this diagnostic because the type alias T
,
which expands to the type parameter S
, is used in the extends
clause of
the class C
:
typedef T<S> = S;
class C extends T<Object> {}
Common fixes
#Use the value of the type argument directly:
typedef T<S> = S;
class C extends Object {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。