Validate.oneOf constructor Null safety
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
.
This validator can be used for String and int properties.
@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._(
value: values,
onUpdate: onUpdate,
onInsert: onInsert,
validator: ValidateType.oneOf,
);