willUpdate method Null safety

void willUpdate()

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

Subclasses of this type may override this method to set or modify values prior to being updated via Query.update or Query.updateOne. It is automatically invoked by Query.update and Query.updateOne.

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 'updatedDate' of an object each time it was updated:

    @override
    void willUpdate() {
      updatedDate = 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.

Implementation

void willUpdate() {}