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

Side by Side Diff: lib/resource.dart

Issue 1606473002: Add examples to resource package. (Closed) Base URL: https://github.com/dart-lang/resource.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// A [Resource] is data that can be loaded into a Dart program. 5 /// A [Resource] is data that can be read into a Dart program.
6 /// 6 ///
7 /// A resource is identified by a URI. 7 /// A resource is identified by a URI. It can be loaded as bytes or data.
8 /// The resource URI may be a `package:` URI.
9 ///
10 /// Example:
11 ///
12 /// var resource = new Resource("package:foo/foo_data.txt");
13 /// var string = await resource.readAsString(UTF8);
14 /// print(string);
15 ///
16 /// Example:
17 ///
18 /// var resource = new Resource("http://example.com/data.json");
19 /// var obj = await resource.openRead() // Reads as stream of bytes.
20 /// .transform(UTF8.fuse(JSON).decoder)
21 /// .first;
22 ///
23 ///
24 /// Notice: Currently this package requires `dart:io` to do the reading,
25 /// so it doesn't work in the browser.
8 library resource; 26 library resource;
9 27
10 export "src/resource.dart" show Resource; 28 export "src/resource.dart" show Resource;
11 export "src/loader.dart" show ResourceLoader; 29 export "src/loader.dart" show ResourceLoader;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698