Transaction class

A Transaction is passed to the function given to FirebaseFirestore.runTransaction, to read and write documents within the transaction.

All the reads must come before the first write.

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

delete(DocumentReference<Object?> documentRef) → Transaction
Deletes the document referred to by documentRef.
get<T extends Object?>(DocumentReference<T> documentRef) → Future<DocumentSnapshot<T>>
Reads the document referred to by documentRef.
getAggregate(AggregateQuery aggregateQuery) → Future<AggregateQuerySnapshot>
Runs the aggregation aggregateQuery on the backend inside this transaction. Only in a read-only transaction, like getQuery.
getQuery<T extends Object?>(Query<T> query) → Future<QuerySnapshot<T>>
Runs query on the backend inside this transaction. Only in a read-only transaction (runTransaction(..., readOnly: true)): the documents are those of the snapshot of the database that every read of the transaction sees.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set<T extends Object?>(DocumentReference<T> documentRef, T data, [SetOptions? options]) → Transaction
Writes data to the document referred to by documentRef. If the document does not exist yet, it is created. With merge options the data is merged into the existing document.
toString() → String
A string representation of this object.
inherited
update(DocumentReference<Object?> documentRef, Map<Object, Object?> data) → Transaction
Updates the fields in data of the document referred to by documentRef. Each key is a field path: a String (dots separate nested fields) or a FieldPath. The transaction fails if the document does not exist.

Operators

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