completed property

Future<Database> get completed

Provides a Future which will be completed once the transaction has completed.

The future will error if an error occurs on the transaction or if the transaction is aborted.

Implementation

Future<Database> get completed {
  var completer = new Completer<Database>();

  this.onComplete.first.then((_) {
    completer.complete(db);
  });

  this.onError.first.then((e) {
    completer.completeError(e);
  });

  this.onAbort.first.then((e) {
    // Avoid completing twice if an error occurs.
    if (!completer.isCompleted) {
      completer.completeError(e);
    }
  });

  return completer.future;
}