# fillRange method

1. @override

void fillRange(

1. int start,
2. int end, [
3. E? fillValue

])
override

Overwrites a range of elements with `fillValue`.

Sets the positions greater than or equal to `start` and less than `end`, to `fillValue`.

The provided range, given by `start` and `end`, must be valid. A range from `start` to `end` is valid if 0 ≤ `start` ≤ `end` ≤ length. An empty range (with `end == start`) is valid.

If the element type is not nullable, the `fillValue` must be provided and must be non-`null`.

Example:

    final words = List.filled(5, 'old');
    print(words); // [old, old, old, old, old]
    words.fillRange(1, 3, 'new');
    print(words); // [old, new, new, old, old]

## Implementation

    @override
    void fillRange(int start, int end, [E? fillValue]) {
      if (start < 0 || start > _length || end < 0 || end > _length || start > end) {
        throw RangeError.range(start, 0, _length, 'start');
      }
      if (fillValue == null && null is! E) {
        throw InvalidArgumentException('fillValue must not be null for non-nullable type E');
      }
      _Node<E>? current = _getNodeAt(start);
      for (int i = start; i < end; i++) {
        current!.value = fillValue as E;
        current = current.next;
      }
    }