forEachSegment method

void forEachSegment(
  1. void f(
    1. Uint8List buf,
    2. int offset,
    3. int length
    )
)

Calls f for each segment as (buffer, offset, length).

This is the lowest-allocation way to consume a borrowed view.

Implementation

void forEachSegment(void Function(Uint8List buf, int offset, int length) f) {
  _ensureValid();
  final n1 = _len1;
  if (n1 != 0) f(_buf1, _off1, n1);
  final n2 = _len2;
  if (n2 != 0) f(_buf2, _off2, n2);
}