update method Null safety
- int index,
- 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;
}