以下示例是关于Dart中包含如何结合两个列表用法的示例代码,想了解如何结合两个列表的具体用法?如何结合两个列表怎么用?如何结合两个列表使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。
You can use:
var newList = new List.from(list1)..addAll(list2);
If you have several lists you can use:
var newList = [list1, list2, list3].expand((x) => x).toList()
As of Dart 2 you can now use +:
var newList = list1 + list2 + list3;
As of Dart 2.3 you can use the spread operator:
var newList = [...list1, ...list2, ...list3];
本文地址:https://www.itbaoku.cn/snippets/785401.html