unique<T> static method

FormFieldValidator<T> unique<T>(
  1. List<T> values, {
  2. String? errorText,
  3. bool checkNullOrEmpty = true,
})

FormFieldValidator that checks if the value is unique in a list of values.

Parameters:

  • values The list of values to check against.
  • errorText The error message when the value is not unique.
  • checkNullOrEmpty Whether to check for null or empty values.

Implementation

static FormFieldValidator<T> unique<T>(
  List<T> values, {
  String? errorText,
  bool checkNullOrEmpty = true,
}) => UniqueValidator<T>(
  values,
  errorText: errorText,
  checkNullOrEmpty: checkNullOrEmpty,
).validate;