Transaction class

Represents a transaction for atomic operations.

Use in runTransaction to perform gets, sets, updates, deletes atomically.

Parameters:

  • name: A unique name for the transaction.

Returns: An instance of Transaction.

Example:

await oracledb.runTransaction((transaction) async {
  var doc = await transaction.get(docRef);
  transaction.update(docRef, {'count': doc.data()['count'] + 1});
});

Constructors

Transaction({required String name})

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?> docRef) → Transaction
Queues a delete operation for the given document.
get<T extends Object?>(DocumentReference<T> docRef) → Future<DocumentSnapshot<T>>
Gets a document within the transaction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set<T>(DocumentReference<T> docRef, T data, [SetOptions? options]) → Transaction
Queues a set operation for the given document.
toString() → String
A string representation of this object.
inherited
update(DocumentReference<Object?> docRef, Map<String, dynamic> data) → Transaction
Queues an update operation for the given document.

Operators

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