next method Null safety

bool next(
  1. TokenType type
)

Implementation

bool next(TokenType type) {
  if (_index >= scanner.tokens.length - 1) return false;
  var peek = scanner.tokens[_index + 1];

  if (peek.type != type) return false;

  _current = peek;
  _index++;
  return true;
}