validate method
Returns String
containing the error message if value
is invalid.
or null
when value
is valid.
Implementation
@override
String? validate(String? value) {
final regex = RegExp(pattern);
return !regex.hasMatch(value ?? '') ? message : null;
}