transaction method
Starts a write transaction on the store.
Reads the current value of key
from the store, including the current
eTag. Returns a transaction constructed from that result. You can use that
transaction to update or delete the store entry, making sure it has not
been modified since it was read.
If eTagReceiver
was specified, it will contain the current eTag of the
updated or deleted entry after the transaction was committed. Not
after this future resolves, like for other methods. To get the eTag of
the read operation, use FirebaseTransaction.eTag.
Implementation
Future<FirebaseTransaction<T>> transaction(
String key, {
ETagReceiver? eTagReceiver,
}) async {
final response = await restApi.get(
path: _buildPath(key),
eTag: true,
);
return StoreTransaction(
store: this,
key: key,
value: response.data != null ? dataFromJson(response.data) : null,
eTag: response.eTag!,
eTagReceiver: eTagReceiver,
);
}