containsElement<T> static method

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

FormFieldValidator that requires the field's value to be in a list of values.

Parameters:

  • values The list of values that the field's value should be in.
  • errorText The error message when the value is not in the list.
  • checkNullOrEmpty Whether to check for null or empty values.

Implementation

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