validate method
Return null if valid, otherwise a ValidationException.
Implementation
@override
ValidationException? validate(Object? value) {
if (value is String) {
for (var char in value.split('')) {
if (!allowedChars.contains(char)) {
return ValidationException(this, value);
}
}
return null;
} else {
return ValidationException(
this,
value,
'Value must be a String type (is ${value.runtimeType})',
);
}
}