skip method Null safety

Operation? skip(
  1. int length
)

Skips length characters in source delta.

Returns last skipped operation, or null if there was nothing to skip.

Implementation

Operation? skip(int length) {
  var skipped = 0;
  Operation? op;
  while (skipped < length && hasNext) {
    final opLength = peekLength();
    final skip = math.min(length - skipped, opLength);
    op = next(skip);
    skipped += op.length!;
  }
  return op;
}