afterCommit method

void afterCommit(
  1. FutureOr task()
)

Adds a task that will be executed after the transaction is committed

  • successfully.
  • Note: task will be executed directly if the transaction was committed.

Implementation

void afterCommit(FutureOr task()) {
  if (_closed) {
    if (_error == null)
      Timer.run(() => _invokeTask(task));
    return;
  }

  (_afterCommits ??= <_Task>[]).add(task);
}