update method

E? update(
  1. int index,
  2. E? newValue
)

Set the element at index to newValue.

The old value at index is returned. The listeners will be notified.

Implementation

E? update(int index, E? newValue) {
  E? oldValue = elementAt(index);
  replace(elementAt(index), newValue);
  notifyListeners();
  return oldValue;
}