void replaceRange(
int start,
int end,
Iterable<E> replacement
)

Removes the objects in the range start inclusive to end exclusive and inserts the contents of replacement in its place.

List<int> list = [1, 2, 3, 4, 5];
list.replaceRange(1, 4, [6, 7]);
list.join(', '); // '1, 6, 7, 5'

An error occurs if start..end is not a valid range for this.

This method does not work on fixed-length lists, even when replacement has the same number of elements as the replaced range. In that case use setRange instead.

Source

/**
 * Removes the objects in the range [start] inclusive to [end] exclusive
 * and inserts the contents of [replacement] in its place.
 *
 *     List<int> list = [1, 2, 3, 4, 5];
 *     list.replaceRange(1, 4, [6, 7]);
 *     list.join(', '); // '1, 6, 7, 5'
 *
 * An error occurs if [start]..[end] is not a valid range for `this`.
 *
 * This method does not work on fixed-length lists, even when [replacement]
 * has the same number of elements as the replaced range. In that case use
 * [setRange] instead.
 */
void replaceRange(int start, int end, Iterable<E> replacement);