update method
Updates the document with the given data
.
The update will be reflected optimistically locally and will be applied
to the server later.
If a transactionId is provided, the update will be applied to the server
as an atomic operation together with the rest of the operations in the
transaction and the update will not reflect locally until the
transaction is completed locally.
The returned Future will complete once the update has been applied to the server or immediately if the update is part of a transaction.
Implementation
Future<void> update(DocumentData data, [TransactionId? transactionId]) =>
_dataManager.applyOutgoingMutation(
Mutation.update(
squidDocIdObj: parseSquidDocId(squidDocId),
properties: {
for (var e in data.entries)
e.key: [
e.value != null
? PropertyMutation.update(e.value)
: PropertyMutation.removeProperty()
]
}),
transactionId);