operator []= method

void operator []=(
  1. Object keyOrIndex,
  2. dynamic value
)

Sets an element of data by index or key.

keyOrIndex may be a String or int. value must be a JSON-encodable value.

When data is a Map, keyOrIndex must be a String and will set value for the key keyOrIndex.

When data is a List, keyOrIndex must be a int and will set value for the index keyOrIndex. This index must be within the length of data. For all other List operations, you may cast data to List.

Implementation

void operator []=(Object keyOrIndex, dynamic value) {
  data[keyOrIndex] = value;
}