SaveConflictHandler typedef Database
Custom conflict handler for saving a document.
This handler is called if the save would cause a conflict, i.e. if the document in the database has been updated (probably by a pull replicator, or by application code) since it was loaded into the Document being saved.
The documentBeingSaved (same as the parameter you passed to
Collection.saveDocumentWithConflictHandler.) may be modify by the callback
as necessary to resolve the conflict.
The handler receives the revision of the conflictingDocument currently in
the database, which has been changed since documentBeingSaved was loaded.
It can be be null, meaning that the document has been deleted.
The handler has to make a decision by returning true to save the document
or false to abort the save.
If the handler throws the save will be aborted.
See also:
- Collection.saveDocumentWithConflictHandler for saving a Document with a custom conflict handler.
Implementation
typedef SaveConflictHandler =
FutureOr<bool> Function(
MutableDocument documentBeingSaved,
Document? conflictingDocument,
);