prepend method

Iterable<T> prepend(
  1. T value
)

Inserts an element at the beginning of the iterable.

Takes the specified element and inserts it at the beginning of the iterable.

Example:

void main() {
  final list = [1, 2, 3, 4];
  final result = list.prepend(0);

  // Result: [0, 1, 2, 3, 4]
}

Implementation

Iterable<T> prepend(T value) sync* {
  yield value;
  yield* this;
}