maxLength<T> static method
Implementation
static FormFieldValidator<T> maxLength<T>(int maxLength, {String? errorText}) {
assert(maxLength > 0);
return (T? valueCandidate) {
assert(valueCandidate is String || valueCandidate is Iterable || valueCandidate == null);
int valueLength = 0;
if (valueCandidate is String) valueLength = valueCandidate.length;
if (valueCandidate is Iterable) valueLength = valueCandidate.length;
return null != valueCandidate && valueLength > maxLength
? errorText ?? BasicFormValidatorMessageError().maxLength!(maxLength)
: null;
};
}