copyInto method

Vector<T> copyInto(
  1. Vector<T> target
)

Returns the target vector with all elements of this vector copied into it.

Implementation

Vector<T> copyInto(Vector<T> target) {
  assert(
      count == target.count,
      'Count of this vector ($count) and the target vector '
      '(${target.count}) must match.');
  if (this != target) {
    for (var i = 0; i < count; i++) {
      target.setUnchecked(i, getUnchecked(i));
    }
  }
  return target;
}