【发布时间】:2020-03-21 06:31:17
【问题描述】:
我在将 dart 1.25 代码转换为 2.7 时遇到问题。 我的问题是泛型扩展约束。
在较旧的 dart 1.25 版本中,泛型类型在未指定时被理解为 num。
void main() {
CustomType customType = new CustomType();// no T specified
}
class CustomType<T extends num> {
CustomType() {
print(T is num);//> why is this false ?
}
}
为什么不是这样?
【问题讨论】: