validateValue method
Validates the value.
Returns null
if the value is valid, otherwise an error message.
Call validate() instead of this method when using the validator.
Implementation
@override
String? validateValue(T valueCandidate) {
int valueLength = 0;
if (valueCandidate is String) valueLength = valueCandidate.length;
if (valueCandidate is Iterable) valueLength = valueCandidate.length;
if (valueCandidate is Map) valueLength = valueCandidate.length;
return valueLength != length && (!allowEmpty || valueLength > 0)
? errorText
: null;
}