Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Change signature of methods overriding Future.then (#7)
Browse files Browse the repository at this point in the history
The signature is:
Future<T>.then (<S>((T) → dynamic, {onError: Function}) → Future<S>)

Use `dynamic` rather than leave off the type to future proof against
--no-implicit-dynamic

Constrain SDK to version which includes this signature for Future
  • Loading branch information
natebosch authored Oct 21, 2016
1 parent 1579e90 commit 302cafc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.11.3

* Fix strong-mode warning against the signature of Future.then

## 1.11.1

* Fix new strong-mode warnings introduced in Dart 1.17.0.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/delegate/future.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DelegatingFuture<T> implements Future<T> {
Future<T> catchError(Function onError, {bool test(Object error)}) =>
_future.catchError(onError, test: test);

Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), {Function onError}) =>
Future/*<S>*/ then/*<S>*/(dynamic onValue(T value), {Function onError}) =>
_future.then(onValue, onError: onError);

Future<T> whenComplete(action()) => _future.whenComplete(action);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/typed/future.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TypeSafeFuture<T> implements Future<T> {
Future<T> catchError(Function onError, {bool test(Object error)}) async =>
new TypeSafeFuture<T>(_future.catchError(onError, test: test));

Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), {Function onError}) =>
Future/*<S>*/ then/*<S>*/(dynamic onValue(T value), {Function onError}) =>
_future.then((value) => onValue(value as T), onError: onError);

Future<T> whenComplete(action()) =>
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: async
version: 1.11.2
version: 1.11.3
author: Dart Team <misc@dartlang.org>
description: Utility functions and classes related to the 'dart:async' library.
homepage: https://www.github.com/dart-lang/async
Expand All @@ -10,4 +10,4 @@ dev_dependencies:
stack_trace: "^1.0.0"
test: "^0.12.0"
environment:
sdk: ">=1.12.0 <2.0.0"
sdk: ">=1.19.0 <2.0.0"

0 comments on commit 302cafc

Please sign in to comment.