operator []= method

void operator []=(
  1. int index,
  2. dynamic value
)

Sets the element at the specified index.

Parameters:

  • index: The index of the element.
  • value: The new value to set at the specified index.

Throws:

  • Exception if the index is out of range.

Implementation

operator []=(int index, value) {
  assert(rawValue != null);
  if (rawValue == null) {
    throw Exception("Index $index is out of range");
  }
  if (index < 0 || index >= rawValue!.length) {
    throw Exception("Index $index is out of range");
  }
  rawValue![index] = value;
}