Transaction class
A reference to a transaction.
The Transaction object passed to a transaction's updateFunction provides the methods to read and write data within the transaction context. See Firestore.runTransaction.
Constructors
- Transaction.new(Firestore firestore, TransactionOptions? transactionOptions)
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
-
create<
T> (DocumentReference< T> documentRef, T documentData) → void - Create the document referred to by the provided DocumentReference. The operation will fail the transaction if a document exists at the specified location.
-
delete(
DocumentReference< Map< documentRef, {Precondition? precondition}) → voidString, dynamic> > - Deletes the document referred to by this DocumentReference.
-
get<
T> (DocumentReference< T> docRef) → Future<DocumentSnapshot< T> > - Retrieves a single document from the database. Holds a pessimistic lock on the returned document.
-
getAll<
T> (List< DocumentReference< documentsRefs, {List<T> >FieldPath> ? fieldMasks}) → Future<List< DocumentSnapshot< >T> > -
Retrieve multiple documents from the database by the provided
documentsRefs
. Holds a pessimistic lock on all returned documents. If any of the documents do not exist, the operation throws a FirebaseFirestoreAdminException with FirestoreClientErrorCode.notFound. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set<
T> (DocumentReference< T> documentRef, T data) → void - Write to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If the document already exists, its contents will be overwritten with the newly provided data.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
DocumentReference documentRef, Map< Object?, Object?> data, {Precondition? precondition}) → void - Updates fields in the document referred to by the provided DocumentReference. If the document doesn't yet exist, the update fails and returns FirestoreClientErrorCode.notFound.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultMaxTransactionsAttempts → const int
- readAfterWriteErrorMsg → const String
- readOnlyWriteErrorMsg → const String