W3cubDocs

/Dart 2

operator + method

List<E> operator + (List<E> other)
override

Returns the concatenation of this list and other.

Returns a new list containing the elements of this list followed by the elements of other.

The default behavior is to return a normal growable list. Some list types may choose to return a list of the same type as themselves (see Uint8List.+);

Implementation

List<E> operator +(List<E> other) {
  var result = <E>[]..length = (this.length + other.length);
  result.setRange(0, this.length, this);
  result.setRange(this.length, result.length, other);
  return result;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-collection/ListMixin/operator_plus.html