matches method Null safety
Returns a Validator that accepts a value that has a match in regExp
.
If the value is null, it is treated as an empty String.
Implementation
Validator matches(
RegExp regExp, {
String message = "Validator.matches",
}) {
return add(
(value) => regExp.hasMatch(value ?? "") ? null : message,
);
}