Remove an unnecessary "newFuture" utility (#124)
This behaves the same as `Future.microtask`.
Bump the minimum version of the SDK to on which includes `Future` in
`dart:core`.
diff --git a/.travis.yml b/.travis.yml
index 6eb8b78..072da65 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: dart
dart:
- - 2.0.0
+ - 2.1.0
- dev
dart_task:
diff --git a/lib/src/request.dart b/lib/src/request.dart
index 9c6d1cb..5e8461a 100644
--- a/lib/src/request.dart
+++ b/lib/src/request.dart
@@ -275,7 +275,7 @@
void run(void Function(StreamChannel<List<int>>) callback) {
if (called) throw StateError('This request has already been hijacked.');
called = true;
- newFuture(() => _callback(callback));
+ Future.microtask(() => _callback(callback));
}
}
diff --git a/lib/src/util.dart b/lib/src/util.dart
index 5cb0d2e..32a7643 100644
--- a/lib/src/util.dart
+++ b/lib/src/util.dart
@@ -8,11 +8,6 @@
import 'shelf_unmodifiable_map.dart';
-/// Like [new Future], but avoids around issue 11911 by using [new Future.value]
-/// under the covers.
-Future newFuture(void Function() callback) =>
- Future.value().then((_) => callback());
-
/// Run [callback] and capture any errors that would otherwise be top-leveled.
///
/// If [this] is called in a non-root error zone, it will just run [callback]
diff --git a/pubspec.yaml b/pubspec.yaml
index 5c430c5..ff15faf 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -6,7 +6,7 @@
homepage: https://github.com/dart-lang/shelf
environment:
- sdk: ">=2.0.0 <3.0.0"
+ sdk: ">=2.1.0 <3.0.0"
dependencies:
async: ^2.0.7