forEach method

void forEach(
  1. dynamic callback(
    1. T,
    2. int
    ),
  2. int? startIndex,
  3. int? beforeIdx
)

Apply given function callback to all elements of the buffer

Implementation

void forEach(Function(T, int) callback, int? startIndex, int? beforeIdx) {
  startIndex = startIndex ?? 0;
  beforeIdx = beforeIdx ?? buffer.length;
  for (var i = startIndex; i < beforeIdx; i++) {
    callback(buffer[i], i);
  }
}