runTransaction method

  1. @override
FutureOr<void> runTransaction(
  1. FutureOr<void> transaction(
    1. ModelTransactionRef ref
    )
)
override

Do the processing to execute the transaction.

Create an adapter-specific ModelTransactionRef that internally inherits from ModelTransactionRef, create a ModelTransactionDocument from that ModelTransactionRef.read, pass it directly to the TransactionRef], create a ModelTransactionDocument from that ModelTransactionRef.read, pass it directly to the transaction argument, and then execute the transaction.

トランザクションを実行するための処理を行います。

内部でModelTransactionRefを継承したアダプター専用のModelTransactionRefを作成し、そのModelTransactionRef.readからModelTransactionDocumentを作成、それをそのままtransactionの引数に渡し、transactionを実行するようにしてください。

Implementation

@override
FutureOr<void> runTransaction(
  FutureOr<void> Function(
    ModelTransactionRef ref,
  ) transaction,
) async {
  _assert();
  final ref = LocalModelTransactionRef._();
  await transaction.call(ref);
  for (final tmp in ref._transactionList) {
    await tmp.call();
  }
}