setAll method

  1. @override
void setAll(
  1. int index,
  2. Iterable<T> iterable
)
override

Overwrites elements with the objects of iterable. The elements of iterable are written into this list, starting at position index. This operation does not increase the length of the slice or the underlying list. The index must be non-negative and no greater than length. The iterable must not have more elements than what can fit from index to length. If iterable is based on this slice, its values may change during the setAll

Implementation

@override
void setAll(int index, Iterable<T> iterable) {
  final (normalizedStart, normalizedEnd) =
      _validateAndNormalizeRange(index, index + iterable.length);
  final iterator = iterable.iterator;
  for (int i = normalizedStart; i < normalizedEnd; i++) {
    if (!iterator.moveNext()) {
      return;
    }
    _list[i] = iterator.current;
  }
}