fillRange method

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

Fills the range [start, end) with fill and notifies when any slot changes.

Implementation

@override
void fillRange(int start, int end, [E? fill]) {
  bool needNotify = false;
  E value = fill as E;
  RangeError.checkValidRange(start, end, peek.length);
  for (int i = start; i < end; i++) {
    if (!needNotify && peek[i] != value) {
      needNotify = true;
    }
    peek[i] = value;
  }
  if (needNotify) {
    notify();
  }
}