I was wondering if there was an easy way to concatenate two lists in dart to create a brand new list object. I couldn\'t find anything and something like this:
My list:>
Alexandres' answer is the best but if you wanted to use + like in your example you can use Darts operator overloading:
class MyList{
List _internal = new List();
operator +(other) => new List.from(_internal)..addAll(other);
noSuchMethod(inv){
//pass all calls to _internal
}
}
Then:
var newMyList = myList1 + myList2;
Is valid :)