isOptional property

bool get isOptional

Returns true if the generated parser is optional; otherwise returns false.

Implementation

bool get isOptional {
  final parsers = getCombinedParsers().map((e) => e.$1);
  if (parsers.isEmpty) {
    return false;
  }

  if (!isSequential) {
    return parsers.any((e) => e.isOptional);
  }

  return !parsers.any((e) => !e.isOptional);
}