eatString method

bool eatString(
  1. String string
)

Attempts to consume the exact string from the current position.

Returns true if the string was found and consumed, false otherwise.

Implementation

bool eatString(String string) {
  return eat((char, index) => char == string[index], string.length) != null;
}