parseOptionalBooleanAttribute static method

bool parseOptionalBooleanAttribute({
  1. required String line,
  2. required String pattern,
  3. required bool defaultValue,
})

Implementation

static bool parseOptionalBooleanAttribute({
  required String line,
  required String pattern,
  required bool defaultValue,
}) {
  final regExp = RegExp(pattern);
  final List<Match> list = regExp.allMatches(line).toList();
  final ret = list.isEmpty
      ? defaultValue
      : line
          .substring(list.first.start, list.first.end)
          .contains(booleanTrue);
  return ret;
}