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

Side by Side Diff: lib/src/utils.dart

Issue 1306723008: pkg/http: Removed uses of Chain.track (Closed) Base URL: https://github.com/dart-lang/http.git@master
Patch Set: sdk version oops Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « lib/src/multipart_file.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library http.utils; 5 library http.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 10
11 import 'package:stack_trace/stack_trace.dart';
12
13 import 'byte_stream.dart'; 11 import 'byte_stream.dart';
14 12
15 /// Converts a URL query string (or `application/x-www-form-urlencoded` body) 13 /// Converts a URL query string (or `application/x-www-form-urlencoded` body)
16 /// into a [Map] from parameter names to values. 14 /// into a [Map] from parameter names to values.
17 /// 15 ///
18 /// queryToMap("foo=bar&baz=bang&qux"); 16 /// queryToMap("foo=bar&baz=bang&qux");
19 /// //=> {"foo": "bar", "baz": "bang", "qux": ""} 17 /// //=> {"foo": "bar", "baz": "bang", "qux": ""}
20 Map<String, String> queryToMap(String queryList, {Encoding encoding}) { 18 Map<String, String> queryToMap(String queryList, {Encoding encoding}) {
21 var map = {}; 19 var map = {};
22 for (var pair in queryList.split("&")) { 20 for (var pair in queryList.split("&")) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 187 }
190 188
191 int get hashCode => first.hashCode ^ last.hashCode; 189 int get hashCode => first.hashCode ^ last.hashCode;
192 } 190 }
193 191
194 /// Configures [future] so that its result (success or exception) is passed on 192 /// Configures [future] so that its result (success or exception) is passed on
195 /// to [completer]. 193 /// to [completer].
196 void chainToCompleter(Future future, Completer completer) { 194 void chainToCompleter(Future future, Completer completer) {
197 future.then(completer.complete, onError: completer.completeError); 195 future.then(completer.complete, onError: completer.completeError);
198 } 196 }
199
200 /// Like [Future.sync], but wraps the Future in [Chain.track] as well.
201 Future syncFuture(callback()) => Chain.track(new Future.sync(callback));
OLDNEW
« no previous file with comments | « lib/src/multipart_file.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698