concatWithSingleList method

List<E> concatWithSingleList(
  1. Iterable<E> iterable
)

Returns a list that concatenates this iterable with iterable.

If either iterable is empty, the result contains the elements of the other iterable.

Implementation

List<E> concatWithSingleList(Iterable<E> iterable) {
  if (iterable.isEmpty) return toList();
  if (isEmpty) return iterable.toList();

  return <E>[...this, ...iterable];
}