WriteBatch class
A write batch, used to perform multiple writes as a single atomic unit.
A WriteBatch object can be acquired by calling the Firestore.batch() function. It provides methods for adding writes to the write batch. None of the writes are 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.
See: firebase.google.com/docs/reference/js/firebase.firestore.WriteBatch.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- jsObject → WriteBatchJsImpl
-
JS object.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
commit(
) → Future< void> - Commits all of the writes in this write batch as a single atomic unit.
-
delete(
DocumentReference documentRef) → 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, Map< String, dynamic> data, [SetOptions? options]) → WriteBatch -
Writes to the document referred to by the provided DocumentReference.
If the document does not exist yet, it will be created.
If you pass
options
, the provided data can be merged into the existing document. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
DocumentReference documentRef, {Map< String, dynamic> ? data, List? fieldsAndValues}) → WriteBatch - Updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getInstance(
WriteBatchJsImpl jsObject) → WriteBatch -
Creates a new WriteBatch from a
jsObject
.