Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: pkg/http/lib/src/utils.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer_experimental/bin/analyzer.dart ('k') | pkg/http/test/mock_client_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/utils.dart
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index 55444ecf235a5078b955898e24746e96f46714c5..26b8d0f386228aa865b97ee5f94d2376e75e010e 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -164,7 +164,7 @@ Future writeStreamToSink(Stream stream, EventSink sink) {
}
/// Returns a [Future] that asynchronously completes to `null`.
-Future get async => new Future.immediate(null);
+Future get async => new Future.value();
/// Returns a closed [Stream] with no elements.
Stream get emptyStream => streamFromIterable([]);
@@ -234,7 +234,7 @@ void chainToCompleter(Future future, Completer completer) {
Future forEachFuture(Iterable input, Future fn(element)) {
var iterator = input.iterator;
Future nextElement(_) {
- if (!iterator.moveNext()) return new Future.immediate(null);
+ if (!iterator.moveNext()) return new Future.value();
return fn(iterator.current).then(nextElement);
}
return nextElement(null);
« no previous file with comments | « pkg/analyzer_experimental/bin/analyzer.dart ('k') | pkg/http/test/mock_client_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698