validateStringLength function
void
validateStringLength(})
Implementation
void validateStringLength(
String? name,
String? value,
int? min,
int? max, {
bool isRequired = false,
}) {
if (value == null && !isRequired) return;
ArgumentError.checkNotNull(value, name);
ArgumentError.checkNotNull(min, 'min');
ArgumentError.checkNotNull(max, 'max');
if ((min! > value!.length || value.length > max!)) {
throw ArgumentError.value(
value,
name,
'"$name" is either longer than $max or shorter than $min',
);
}
}