isTooShort method
isTooShort compares the length of a string to the minLength to ensure it is greater.
Provides a basic error message that can be used.
'valueName requires at least minLength characters.'
A return value of null indicates a valid length.
thows an ArgumentError if valueName is null or the String value is null
Implementation
String? isTooShort({
int minLength = 0,
String? valueName,
}) {
if (this == null) {
throw ArgumentError('value is required', this);
}
return this!.length < minLength
? '$valueName requires at least $minLength characters.'
: null;
}