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

Side by Side Diff: lib/src/typed/future.dart

Issue 2161283002: Fix Dart 1.17 strong-mode warnings. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « lib/src/delegate/stream_subscription.dart ('k') | lib/src/typed/stream.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 class TypeSafeFuture<T> implements Future<T> { 7 class TypeSafeFuture<T> implements Future<T> {
8 final Future _future; 8 final Future _future;
9 9
10 TypeSafeFuture(this._future); 10 TypeSafeFuture(this._future);
11 11
12 Stream<T> asStream() => _future.then((value) => value as T).asStream(); 12 Stream<T> asStream() => _future.then((value) => value as T).asStream();
13 13
14 Future catchError(Function onError, {bool test(Object error)}) => 14 Future<T> catchError(Function onError, {bool test(Object error)}) async =>
15 _future.catchError(onError, test: test); 15 new TypeSafeFuture<T>(_future.catchError(onError, test: test));
16 16
17 Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), {Function onError}) => 17 Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), {Function onError}) =>
18 _future.then((value) => onValue(value as T), onError: onError); 18 _future.then((value) => onValue(value as T), onError: onError);
19 19
20 Future<T> whenComplete(action()) => 20 Future<T> whenComplete(action()) =>
21 new TypeSafeFuture<T>(_future.whenComplete(action)); 21 new TypeSafeFuture<T>(_future.whenComplete(action));
22 22
23 Future<T> timeout(Duration timeLimit, {onTimeout()}) => 23 Future<T> timeout(Duration timeLimit, {onTimeout()}) =>
24 new TypeSafeFuture<T>(_future.timeout(timeLimit, onTimeout: onTimeout)); 24 new TypeSafeFuture<T>(_future.timeout(timeLimit, onTimeout: onTimeout));
25 } 25 }
OLDNEW
« no previous file with comments | « lib/src/delegate/stream_subscription.dart ('k') | lib/src/typed/stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698