validate method
Return an error message if the value is invalid, otherwise return null.
Implementation
@override
String? validate(dynamic value) {
if(minChars > 0 && value.length < minChars ) {
return "$value must be at least $minChars characters long.";
}
if(maxChars > 0 && value.length > maxChars) {
return "$value must be at most $maxChars characters long.";
}
if(hasOption(optionLowercase)) {
if(value.toLowerCase() != value) {
return "$value must be all lowercase";
}
}
return null;
}