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

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

Issue 12295014: Remove deprecated Strings class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « pkg/args/test/usage_test.dart ('k') | pkg/oauth2/lib/src/authorization_code_grant.dart » ('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 utils; 5 library utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:crypto'; 8 import 'dart:crypto';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:scalarlist'; 10 import 'dart:scalarlist';
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 /// Converts a [Map] from parameter names to values to a URL query string. 33 /// Converts a [Map] from parameter names to values to a URL query string.
34 /// 34 ///
35 /// mapToQuery({"foo": "bar", "baz": "bang"}); 35 /// mapToQuery({"foo": "bar", "baz": "bang"});
36 /// //=> "foo=bar&baz=bang" 36 /// //=> "foo=bar&baz=bang"
37 String mapToQuery(Map<String, String> map) { 37 String mapToQuery(Map<String, String> map) {
38 var pairs = <List<String>>[]; 38 var pairs = <List<String>>[];
39 map.forEach((key, value) => 39 map.forEach((key, value) =>
40 pairs.add([encodeUriComponent(key), encodeUriComponent(value)])); 40 pairs.add([encodeUriComponent(key), encodeUriComponent(value)]));
41 return Strings.join(pairs.map((pair) => "${pair[0]}=${pair[1]}"), "&"); 41 return pairs.map((pair) => "${pair[0]}=${pair[1]}").join("&");
42 } 42 }
43 43
44 /// Adds all key/value pairs from [source] to [destination], overwriting any 44 /// Adds all key/value pairs from [source] to [destination], overwriting any
45 /// pre-existing values. 45 /// pre-existing values.
46 /// 46 ///
47 /// var a = {"foo": "bar", "baz": "bang"}; 47 /// var a = {"foo": "bar", "baz": "bang"};
48 /// mapAddAll(a, {"baz": "zap", "qux": "quux"}); 48 /// mapAddAll(a, {"baz": "zap", "qux": "quux"});
49 /// a; //=> {"foo": "bar", "baz": "zap", "qux": "quux"} 49 /// a; //=> {"foo": "bar", "baz": "zap", "qux": "quux"}
50 void mapAddAll(Map destination, Map source) => 50 void mapAddAll(Map destination, Map source) =>
51 source.forEach((key, value) => destination[key] = value); 51 source.forEach((key, value) => destination[key] = value);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 /// [StreamController]. This exists to work around issue 8310. 315 /// [StreamController]. This exists to work around issue 8310.
316 Stream wrapStream(Stream stream) { 316 Stream wrapStream(Stream stream) {
317 var controller = stream.isBroadcast 317 var controller = stream.isBroadcast
318 ? new StreamController.broadcast() 318 ? new StreamController.broadcast()
319 : new StreamController(); 319 : new StreamController();
320 stream.listen(controller.add, 320 stream.listen(controller.add,
321 onError: (e) => controller.signalError(e), 321 onError: (e) => controller.signalError(e),
322 onDone: controller.close); 322 onDone: controller.close);
323 return controller.stream; 323 return controller.stream;
324 } 324 }
OLDNEW
« no previous file with comments | « pkg/args/test/usage_test.dart ('k') | pkg/oauth2/lib/src/authorization_code_grant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698