updateAt method
Returns a copy of this list replacing the value at the given index
by
applying the function update
to its value.
If there is no element at the provided index
, the list is returned
unchanged.
The resulting list will have the same length as the original list.
Implementation
ImmortalList<T> updateAt(int index, T Function(T value) update) =>
elementAtAsOptional(index)
.map(
(value) => set(index, update(value)),
)
.orElse(this);