operator + method

Iterable<T> operator +(
  1. Iterable<T> other
)

Returns a new Iterable of the same type as this with other's elements appended to the end.

Implementation

Iterable<T> operator +(Iterable<T> other) {
  Iterable<T> iterable;

  if (this is Set<T>) {
    iterable = Set<T>.from(this)..addAll(other);
  } else if (this is List<T>) {
    iterable = List<T>.from(this)..addAll(other);
  } else {
    throw UnsupportedError(
        'This iterable must be a [List] or a [Set] to use the `+` operator.');
  }

  return iterable;
}