如何给已经存在的类型重新命名?

假设我想给List<String>命名Directives,然后能够说directives = new Directives()

最佳答案

现在可以通过一个空的mixin

mixin ToAlias{}

class Stuff<T> {
  T value;
  Stuff(this.value);
}

class StuffInt = Stuff<int> with ToAlias;

main() {
  var stuffInt = StuffInt(3);
}

10-08 13:39