eatBoolean method

bool? eatBoolean()

Attempts to parse and consume a boolean value ('true' or 'false').

Returns true if 'true' is found, false if 'false' is found, or null if neither is found at the current position.

Implementation

bool? eatBoolean() {
  if (eatString('true')) {
    return true;
  } else if (eatString('false')) {
    return false;
  }
  return null;
}