Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: sdk/lib/async/future.dart

Issue 12207044: Update doc for Future.whenComplete. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 0d32aaee8a3daa977ccb35e846ff8a80f36f0af3..a36ffa1c5dc0cf9e53c40da598ab15119f3ca19b 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -276,17 +276,20 @@ abstract class Future<T> {
*
* If the call to [action] returns a [Future], `f2`, then completion of
* `f` is delayed until `f2` completes. If `f2` completes with
- * an error, that will be the result of `f` too.
+ * an error, that will be the result of `f` too. The value of `f2` is always
+ * ignored.
*
* This method is equivalent to:
*
* Future<T> whenComplete(action()) {
* this.then((v) {
- * action();
+ * var f2 = action();
+ * if (f2 is Future) return f2.then((_) => v);
* return v
* },
* onError: (AsyncError e) {
- * action();
+ * var f2 = action();
+ * if (f2 is Future) return f2.then((_) { throw e; });
* throw e;
* });
* }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698