transaction<T> static method

Future<T> transaction<T>(
  1. FutureOr<T> body(
    1. DVContext context
    ), {
  2. bool isolated = false,
})

Runs body as a reversible unit of work.

Use context.afterCommit(...) for irreversible effects that must not happen unless the transaction commits, and context.compensate(...) to register the inverse of an external effect Dartvel cannot reverse itself.

Nested calls join the active transaction unless isolated is set.

Implementation

static Future<T> transaction<T>(
  FutureOr<T> Function(DVContext context) body, {
  bool isolated = false,
}) =>
    _transactionRunner.call<T>(body, isolated: isolated);