Validate<T>.oneOf constructor

const Validate<T>.oneOf(List values, { bool onUpdate: true, bool onInsert: true })

A validator for ensuring a value is one of a set of values.

An input value must be one of values.

values must be homogenous - every value must be the same type - and the property with this metadata must also match the type of the objects in values.

    @Validate.oneOf(const ["A", "B", "C")
    String foo;

If onUpdate is true (the default), this validation is run on update queries. If onInsert is true (the default), this validation is run on insert queries.

Implementation

const Validate.oneOf(List<dynamic> values,
    {bool onUpdate: true, bool onInsert: true})
    : this._(
          values: values,
          onUpdate: onUpdate,
          onInsert: onInsert,
          validator: _BuiltinValidate.oneOf);