endTransaction method

  1. @override
void endTransaction()
override

Ends the transaction, committing it if setTransactionSuccessful was called.

Implementation

@override
void endTransaction() {
  if (!_insideTransaction) {
    throw StateError('No transaction in progress.');
  }
  final _Snapshot? snapshot = _snapshot;
  if (!_transactionSuccessful && snapshot != null) {
    _writes = snapshot.writes;
    _trackedQueries = snapshot.trackedQueries;
    _trackedQueryKeys = snapshot.trackedQueryKeys;
    _serverCacheWrite = snapshot.serverCache;
  }
  _snapshot = null;
  _insideTransaction = false;
  _transactionSuccessful = false;
}