stringIgnoreCase function Null safety

Parser<String> stringIgnoreCase(
  1. String element,
  2. [String? message]

Returns a parser that accepts the string element ignoring the case.

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


Parser<String> stringIgnoreCase(String element, [String? message]) {
  final lowerElement = element.toLowerCase();
  return predicate(element.length, (each) => lowerElement == each.toLowerCase(),
      message ?? '"$element" (case-insensitive) expected');