unique<T, E> static method

Rule<Iterable<T>, E> unique<T, E>({
  1. required E error,
})

Validates that the collection has no duplicate items.

CollectionRules.unique(error: 'Duplicate items not allowed')

Implementation

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