copyFromSlice method

void copyFromSlice(
  1. Slice<T> src
)

Copies the elements from src into self. The length of src must be the same as this.

Implementation

void copyFromSlice(Slice<T> src) {
  final length = len();
  final srcLength = src.len();
  if (length != srcLength) {
    panic(
        "Slices must be the same length, this is `$length` and src is `$src");
  }
  for (var i = src._start, j = _start; i < src._end; i++, j++) {
    _list[j] = src._list[i];
  }
}