willInsert method Null safety

void willInsert()

Callback to modify an object prior to inserting it with a Query.

Subclasses of this type may override this method to set or modify values prior to being inserted via Query.insert. It is automatically invoked by Query.insert.

This method is invoked prior to validation and therefore any values modified in this method are subject to the validation behavior of this instance.

An example implementation would set the 'createdDate' of an object when it is first created

    void willInsert() {
      createdDate = new DateTime.now().toUtc();

This method is only invoked when a query is configured by its Query.values. This method is not invoked if Query.valueMap is used to configure a query.


void willInsert() {}