isSelectField static method

ValidatorEvent isSelectField(
  1. List options
)

Validator to check if a field contains a valid select field. The select field must be a valid value from the list of options. The validator checks whether the provided value is non-null, is a non-empty string, and matches the format of a select field. If the validation fails, an error message 'error.field.select' is returned.

Implementation

static ValidatorEvent isSelectField(List options) => (value) async {
      var res = options.contains(value);
      return FieldValidateResult(
        success: res,
        error: res ? '' : 'error.field.select',
      );
    };