Skip to content

Commit

Permalink
Remove an unnecessary "newFuture" utility (flutter#124)
Browse files Browse the repository at this point in the history
This behaves the same as `Future.microtask`.

Bump the minimum version of the SDK to on which includes `Future` in
`dart:core`.
  • Loading branch information
natebosch authored Dec 5, 2019
1 parent 4bccdd6 commit c52d4b5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: dart

dart:
- 2.0.0
- 2.1.0
- dev

dart_task:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class _OnHijack {
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));
}
}

Expand Down
5 changes: 0 additions & 5 deletions lib/src/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import 'package:collection/collection.dart';

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]
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author: Dart Team <misc@dartlang.org>
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
Expand Down

0 comments on commit c52d4b5

Please sign in to comment.