scanChar method Null safety

bool scanChar(
  1. int character
)

If the next character in the string is character, consumes it.

Returns whether or not character was consumed.

Implementation

bool scanChar(int character) {
  if (isDone) return false;
  if (string.codeUnitAt(_position) != character) return false;
  _position++;
  return true;
}