validator method
A function that must return a validation error if the provided
value is invalid and null otherwise.
Implementation
@override
NumberDocumentError? validator(String value) {
final trimmed = value.trim();
if (trimmed.isEmpty) return NumberDocumentError.empty;
if (trimmed.length < minLength) return NumberDocumentError.tooShort;
if (maxLength != null && trimmed.length > maxLength!) {
return NumberDocumentError.tooLong;
}
return null;
}