maxLength static method

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

Fails when the value is longer than length characters.

Implementation

static FormFieldValidator<String> maxLength(int length, [String? message]) =>
    (value) => (value ?? '').length > length
        ? (message ?? 'Must be at most $length characters')
        : null;