Validate.absent constructor Null safety
A validator for ensuring a property does not have a value when being inserted or updated.
This metadata requires that a property must NOT be set in Query.values before an update or insert.
This validation is used to restrict input during either an insert or update query. For example, a 'dateCreated' property would use this validator to ensure that property isn't set during an update.
@Validate.absent(onUpdate: true, onInsert: false)
DateTime dateCreated;
If onUpdate
is true (the default), this validation requires a property to be absent for update queries.
If onInsert
is true (the default), this validation requires a property to be absent for insert queries.
Implementation
const Validate.absent({bool onUpdate = true, bool onInsert = true})
: this._(
onUpdate: onUpdate,
onInsert: onInsert,
validator: ValidateType.absent,
);