📅  最后修改于: 2022-03-11 14:48:03.855000             🧑  作者: Mango
/*Dart 2.3 introduced the spread operator (...) and the null-aware spread operator (...?),
which provide a concise way to insert multiple values into a collection.
For example, you can use the spread operator (...)
to insert all the values of a list into another list:*/
var list = [1, 2, 3];
var list2 = [0, ...list];//var list and values added to list2 wich contains 0 already.
assert(list2.length == 4);
/*If the expression to the right of the spread operator might be null,
you can avoid exceptions by using a null-aware spread operator (...?):*/
var list;
var list2 = [0, ...?list];
assert(list2.length == 1);