maxLength<E> static method

Rule<String, E> maxLength<E>(
  1. int max, {
  2. required E error,
})

Validates that the string has at most max characters.

StringRules.maxLength(100, error: 'Must be at most 100 characters')

Implementation

static Rule<String, E> maxLength<E>(int max, {required E error}) =>
    PredicateRule(predicate: (value) => value.length <= max, error: error);