minLength function

String minLength (
  1. String fieldValue,
  2. int minLen,
  3. {String message}
)

Validates that the string fieldValue is not shorter than minLen.

Returns null if fieldValue.length() >= minLen else an error message

Implementation

String minLength(
  String fieldValue,
  int minLen, {
  String message,
}) {
  if ((fieldValue == null) || (fieldValue.length >= minLen)) {
    return null;
  }
  return message ?? 'Please enter at least $minLen characters';
}