pattern<T> static method
when valid
- value is null
- value match pattern
Implementation
static FormeValidator<T> pattern<T>(String pattern, {String errorText = ''}) {
return (f, T v) {
if (v == null) {
return null;
}
final bool isValid = RegExp(pattern).hasMatch(v as String);
if (!isValid) {
return errorText;
}
return null;
};
}