transaction<T> method
Executes delegate inside of a database transaction.
If transaction is called from inside of another transaction's delegate,
the parent transaction / database context will be forwarded so
methods using transaction can be combined into larger transactions.
Implementation
Future<T> transaction<T>(
Future<T> Function(DatabaseContext context) delegate) async {
return await _adapter.useConnection((connection) async {
return await connection.runTransaction(delegate);
});
}