maxLength static method

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

Implementation

static FormFieldValidator<List> maxLength(int length, [String? message]) {
  return (List? value) {
    if (value != null && value.length > length) {
      return message ?? 'This field must have at most $length items';
    }

    return null;
  };
}