peek method

String? peek(
  1. int linesAhead
)

Gets the line that is linesAhead lines ahead of the current one, or null if there is none.

peek(0) is equivalent to current.

peek(1) is equivalent to next.

Implementation

String? peek(int linesAhead) {
  if (linesAhead < 0) {
    throw ArgumentError('Invalid linesAhead: $linesAhead; must be >= 0.');
  }
  // Don't read past the end.
  if (_pos >= lines.length - linesAhead) {
    return null;
  }
  return lines[_pos + linesAhead];
}