insert method

void insert(
  1. int index,
  2. T value
)

Inserts value at the specified index.

Guarantees memory safety by allowing index strictly between 0 and length (inclusive).

Implementation

void insert(int index, T value) {
  if (index < 0 || index > _data.length) {
    throw RangeError.index(index, _data, 'Index out of bounds for insertion');
  }
  _data.insert(index, value);
}