lengthRange<E> static method

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

Validates that the string length is within min and max (inclusive).

StringRules.lengthRange(3, 20, error: 'Must be 3-20 characters')

Implementation

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