aee77b9a33
Closes https://github.com/dart-lang/sdk/pull/50880 TEST=ci GitOrigin-RevId: ea8ecf4b7b921de0549df325be1a1f7879e86b72 Change-Id: I39315609a8390b012196a08c9ce4a9a6a50b1558 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278061 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Michael Thomsen <mit@google.com> Reviewed-by: Michael Thomsen <mit@google.com>
39 lines
990 B
Plaintext
39 lines
990 B
Plaintext
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
part of $LIBRARYNAME;
|
|
|
|
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
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;
|
|
}
|
|
|
|
$!MEMBERS
|
|
}
|