Chromium Code Reviews| Index: lib/src/delegate/future.dart |
| diff --git a/lib/src/delegate/future.dart b/lib/src/delegate/future.dart |
| index bfc075b794d09eda0c35f38a862cedc60090fc18..eed3c0ef35f06329599f047d02b1eca4f6b30d0e 100644 |
| --- a/lib/src/delegate/future.dart |
| +++ b/lib/src/delegate/future.dart |
| @@ -4,6 +4,8 @@ |
| import 'dart:async'; |
| +import '../typed/future.dart'; |
| + |
| /// A wrapper that forwards calls to a [Future]. |
| class DelegatingFuture<T> implements Future<T> { |
| /// The wrapped [Future]. |
| @@ -11,6 +13,14 @@ class DelegatingFuture<T> implements Future<T> { |
| DelegatingFuture(this._future); |
| + /// Creates a wrapper that asserts the types of the value emitted by [future]. |
|
Lasse Reichstein Nielsen
2016/04/08 09:20:29
"asserts" isn't clear.
Maybe:
Creates a `Future
nweiz
2016/04/11 20:26:16
Done.
|
| + /// |
| + /// This soundly converts a [Future] without a generic type to a `Future<T>` |
|
Lasse Reichstein Nielsen
2016/04/08 09:20:29
You can't have a Future without a generic type - t
nweiz
2016/04/11 20:26:16
Done.
|
| + /// by asserting that its value is an instance of `T` whenever it's accessed. |
|
Lasse Reichstein Nielsen
2016/04/08 09:20:29
You don't "access" a future value, it's push, not
nweiz
2016/04/11 20:26:16
Done.
|
| + /// If it's not, it throws a [CastError]. |
|
Lasse Reichstein Nielsen
2016/04/08 09:20:29
Two "it"s referring to different things in the sam
nweiz
2016/04/11 20:26:16
Done.
|
| + static Future/*<T>*/ typed/*<T>*/(Future future) => |
| + future is Future/*<T>*/ ? future : new TypeSafeFuture/*<T>*/(future); |
| + |
| Stream<T> asStream() => _future.asStream(); |
| Future catchError(Function onError, {bool test(Object error)}) => |
| @@ -21,6 +31,6 @@ class DelegatingFuture<T> implements Future<T> { |
| Future<T> whenComplete(action()) => _future.whenComplete(action); |
| - Future<T> timeout(Duration timeLimit, {void onTimeout()}) => |
| + Future<T> timeout(Duration timeLimit, {onTimeout()}) => |
| _future.timeout(timeLimit, onTimeout: onTimeout); |
| } |