本文介绍了如何创建类型别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为现有类型赋予新名称?
How do I give a new name to already existing type?
假设我要赋予 List< String> code>名称 Directives ,然后可以说出 directives = new Directives()。
Let's say I want to give to a List<String> the name Directives and then be able to say directives = new Directives().
推荐答案现在可以通过空的mixin
It is possible now via an empty mixin
mixin ToAlias{} class Stuff<T> { T value; Stuff(this.value); } class StuffInt = Stuff<int> with ToAlias; main() { var stuffInt = StuffInt(3); }更多推荐
如何创建类型别名
发布评论