commit method
Commit the transaction
Implementation
@override
Future<void> commit() async {
_checkActive();
try {
await _database.transaction((txn) async {
for (final operation in _pendingOperations) {
await operation.execute(txn);
}
});
_isCommitted = true;
} catch (e) {
// If transaction fails, fail all pending operations
for (final operation in _pendingOperations) {
if (!operation.isCompleted) {
operation.fail(AdapterError(
'Transaction failed: ${e.toString()}',
originalError: e,
));
}
}
rethrow;
} finally {
_isActive = false;
}
}