match method
Instructs StringMust to check
whether the given value matches pattern
.
Implementation
void match(RegExp pattern, [String? errorMessage]) {
final err = errorMessage ?? 'String does not match pattern $pattern';
_validators.add((value) {
if (value == null) return err;
final match = pattern.hasMatch(value);
if (match) return '';
return err;
});
}