Update doc for Future.whenComplete.

Review URL: https://codereview.chromium.org//12207044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18226 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
floitsch@google.com
2013-02-07 16:49:06 +00:00
parent dd917e2498
commit 38aa4e1024
+6 -3
View File
@@ -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;
* });
* }