maxLength static method

String? maxLength(
  1. String? value,
  2. int maxLength, {
  3. String? errorMessage,
})

Implementation

static String? maxLength(String? value, int maxLength, {String? errorMessage}) {
  if (value != null && value.length > maxLength) {
    return errorMessage ?? 'Maximum length is $maxLength characters';
  }
  return null;
}