maxLength static method

FormFieldValidator<String> maxLength(
  1. int length, [
  2. String? message
])

Implementation

static FormFieldValidator<String> maxLength(int length, [String? message]) {
  return (String? value) {
    if ((value?.length ?? 0) > length) {
      return message ?? 'This field must be less than $length characters';
    }

    return null;
  };
}