fillRange method

void fillRange (
  1. int start,
  2. int end,
  3. [E fill]
)
override

Sets the objects in the range start inclusive to end exclusive to the given fillValue.

The provided range, given by start and end, must be valid. A range from start to end is valid if 0 <= start <= end <= len, where len is this list's length. The range starts at start and has length end - start. An empty range (with end == start) is valid.

Example:

 List<int> list = new List(3);
    list.fillRange(0, 2, 1);
    print(list); //  [1, 1, null]

Implementation

void fillRange(int start, int end, [E fill]) {
  RangeError.checkValidRange(start, end, this.length);
  for (int i = start; i < end; i++) {
    this[i] = fill;
  }
}