string function

  1. @useResult
Parser<String> string(
  1. String element, [
  2. String? message
])

Returns a parser that accepts the string element.

For example, string('foo') succeeds and consumes the input string 'foo'. Fails for any other input.

Implementation

@useResult
Parser<String> string(String element, [String? message]) => predicate(
    element.length,
    (each) => element == each,
    message ?? '"$element" expected');