replaceAt<T> static method
Returns a new list with the element at index replaced by value.
Throws RangeError when index is out of range.
Implementation
static List<T> replaceAt<T>(Iterable<T> list, int index, T value) {
final source = list.toList();
if (index < 0 || index >= source.length) {
throw RangeError.index(index, source);
}
source[index] = value;
return source;
}