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

Side by Side Diff: pkg/intl/lib/src/lazy_locale_data.dart

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 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 | Annotate | Revision Log
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 /** 5 /**
6 * This defines a class for loading locale data incrementally from 6 * This defines a class for loading locale data incrementally from
7 * an external source as JSON. The external sources expected are either 7 * an external source as JSON. The external sources expected are either
8 * local files or via HTTP request. 8 * local files or via HTTP request.
9 */ 9 */
10 10
11 library lazy_locale_data; 11 library lazy_locale_data;
12 import 'dart:async'; 12 import 'dart:async';
13 import 'dart:convert';
13 import 'intl_helpers.dart'; 14 import 'intl_helpers.dart';
14 import 'dart:json' as json;
15 15
16 /** 16 /**
17 * This implements the very basic map-type operations which are used 17 * This implements the very basic map-type operations which are used
18 * in locale lookup, and looks them up based on a URL that defines 18 * in locale lookup, and looks them up based on a URL that defines
19 * the external source. 19 * the external source.
20 */ 20 */
21 class LazyLocaleData { 21 class LazyLocaleData {
22 /// This holds the data we have loaded. 22 /// This holds the data we have loaded.
23 Map map; 23 Map map;
24 24
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 var data = _reader.read(localeName); 101 var data = _reader.read(localeName);
102 return jsonData(data).then( (input) { 102 return jsonData(data).then( (input) {
103 map[localeName] = _creationFunction(input);}); 103 map[localeName] = _creationFunction(input);});
104 } 104 }
105 105
106 /** 106 /**
107 * Given a Future [input] whose value is expected to be a string in JSON form, 107 * Given a Future [input] whose value is expected to be a string in JSON form,
108 * return another future that parses the JSON into a usable format. 108 * return another future that parses the JSON into a usable format.
109 */ 109 */
110 Future jsonData(Future input) { 110 Future jsonData(Future input) {
111 return input.then( (response) => json.parse(response)); 111 return input.then( (response) => JSON.decode(response));
112 } 112 }
113 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698