followedBy method

  1. @override
Iterable<E> followedBy(
  1. Iterable<E> other, {
  2. bool labeled = false,
  3. bool? growable,
})

Creates the lazy concatenation of this iterable and other.

The returned iterable will provide the same elements as this iterable, and, after that, the elements of other, in the same order as in the original iterables.

Example:

var planets = <String>['Earth', 'Jupiter'];
var updated = planets.followedBy(['Mars', 'Venus']);
print(updated); // (Earth, Jupiter, Mars, Venus)

Implementation

@override
Iterable<E> followedBy(
  Iterable<E> other, {
  bool labeled = false,
  bool? growable,
}) {
  final elements = this.elements.followedBy(other);
  if (!labeled) return elements;
  var labels = _labels;
  if (other is LabeledList) labels += (other as LabeledList)._labels;
  growable ??= this.growable;
  return LabeledList<E>.of(elements, labels: labels, growable: growable);
}