minLength static method
Validate minimum length
Implementation
static String? minLength(String? value, int minLength, {String? fieldName}) {
if (value == null || value.isEmpty) {
return '${fieldName ?? 'This field'} is required';
}
if (value.length < minLength) {
return '${fieldName ?? 'This field'} must be at least $minLength characters';
}
return null;
}