maxLength<T, E> static method

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

Validates that the collection has at most max items.

CollectionRules.maxLength(10, error: 'Maximum 10 items')

Implementation

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