Change signature of methods overriding Future.then (#7)
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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d47eaf..eafa7b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
diff --git a/lib/src/delegate/future.dart b/lib/src/delegate/future.dart
index 8b81076..e30d41d 100644
--- a/lib/src/delegate/future.dart
+++ b/lib/src/delegate/future.dart
@@ -27,7 +27,7 @@
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);
diff --git a/lib/src/typed/future.dart b/lib/src/typed/future.dart
index f53ec5f..995f4b5 100644
--- a/lib/src/typed/future.dart
+++ b/lib/src/typed/future.dart
@@ -14,7 +14,7 @@
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()) =>
diff --git a/pubspec.yaml b/pubspec.yaml
index 3981abb..2741747 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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
@@ -10,4 +10,4 @@
stack_trace: "^1.0.0"
test: "^0.12.0"
environment:
- sdk: ">=1.12.0 <2.0.0"
+ sdk: ">=1.19.0 <2.0.0"