isValid method

  1. @override
bool isValid(
  1. String value
)
override

value: the input string returns: true if the input string is a full match for regexSource

Implementation

@override
bool isValid(String value) {
  try {
    final regex = RegExp(regexSource!);
    final matches = regex.allMatches(value);
    for (Match match in matches) {
      if (match.start == 0 && match.end == value.length) {
        return true;
      }
    }
    return false;
  } catch (e) {
    // Invalid regex
    assert(false, e.toString());
    return true;
  }
}