WriteBatch extension type

A write batch, used to perform multiple writes as a single atomic unit.

A WriteBatch object can be acquired by calling Firestore.batch(). It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until WriteBatch.commit() is called.

Unlike transactions, write batches are persisted offline and therefore are preferable when you don't need to condition your writes on read data.

on
Implemented types
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

commit() JSPromise<JSArray<WriteResult>>
Commits all of the writes in this write batch as a single atomic unit.
create(DocumentReference documentRef, JSObject data) WriteBatch
Create the document referred to by the provided DocumentReference. The operation will fail the batch if a document exists at the specified location.
delete(DocumentReference documentRef, [Precondition precondition]) WriteBatch
Deletes the document referred to by the provided DocumentReference.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(DocumentReference documentRef, JSObject data, [SetOptions options]) WriteBatch
Write to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If you pass SetOptions, the provided data can be merged into the existing document.
toString() String
A string representation of this object.
inherited
update(DocumentReference documentRef, JSObject data, [Precondition precondition]) WriteBatch
Update fields of the document referred to by the provided DocumentReference. If the document doesn't yet exist, the update fails and the entire batch will be rejected.
updateFieldPath(DocumentReference documentRef, JSAny field, JSObject value, [JSArray<JSAny> precondition]) WriteBatch
Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.

Operators

operator ==(Object other) bool
The equality operator.
inherited