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

Commit 302cafc

Browse files
authored
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
1 parent 1579e90 commit 302cafc

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.11.3
2+
3+
* Fix strong-mode warning against the signature of Future.then
4+
15
## 1.11.1
26

37
* Fix new strong-mode warnings introduced in Dart 1.17.0.

lib/src/delegate/future.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DelegatingFuture<T> implements Future<T> {
2727
Future<T> catchError(Function onError, {bool test(Object error)}) =>
2828
_future.catchError(onError, test: test);
2929

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

3333
Future<T> whenComplete(action()) => _future.whenComplete(action);

lib/src/typed/future.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TypeSafeFuture<T> implements Future<T> {
1414
Future<T> catchError(Function onError, {bool test(Object error)}) async =>
1515
new TypeSafeFuture<T>(_future.catchError(onError, test: test));
1616

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

2020
Future<T> whenComplete(action()) =>

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: async
2-
version: 1.11.2
2+
version: 1.11.3
33
author: Dart Team <misc@dartlang.org>
44
description: Utility functions and classes related to the 'dart:async' library.
55
homepage: https://www.github.com/dart-lang/async
@@ -10,4 +10,4 @@ dev_dependencies:
1010
stack_trace: "^1.0.0"
1111
test: "^0.12.0"
1212
environment:
13-
sdk: ">=1.12.0 <2.0.0"
13+
sdk: ">=1.19.0 <2.0.0"

0 commit comments

Comments
 (0)