
此代码创建了一个
List<dynamic>
parsed.map((i) => Example.fromJson(i)).toList();
用代替
List<Example> list = List<Example>.from(parsed.map((i) => Example.fromJson(i)));
要不就
var list = List<Example>.fromn(parsed.map((i) => Example.fromJson(i)));
也可以看看
- 在Dart中,List.from和.of之间以及Map.from和.of之间有什么区别?
- https://api.dartlang.org/stable/2.0.0/dart-core/List/List.from.html
- https://api.dartlang.org/stable/2.0.0/dart-core/List/List.of.html
- Dart 2.X List.cast()无法撰写
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)