commit | 6207097bef061cc804c21118b408fb32e83107fa | [log] [tgz] |
---|---|---|
author | Seth Ladd <sethladd@gmail.com> | Wed Jan 27 08:38:41 2016 -0800 |
committer | Seth Ladd <sethladd@google.com> | Wed Jan 27 13:09:14 2016 -0800 |
tree | 3551812e4cf17ca1546072ea4d66a16b06813f9d | |
parent | d73108e8ccc28e2704e05b8e4bc07e1da23c68b3 [diff] |
Add example to README
Reading data from package contents and files.
A resource is data that can be read into a Dart program at runtime. A resource is identified by a URI. It can be loaded as bytes or data. The resource URI may be a package: URI.
Example:
import 'package:resource/resource.dart' show Resource; import 'dart:convert' show UTF8; main() async { var resource = new Resource("package:foo/foo_data.txt"); var string = await resource.readAsString(UTF8); print(string); }
Please check out the API docs.
The current version of resource.dart
depends on the dart:io
library, and doesn't work in the browser. Use package:resource/browser_resource.dart
in the browser until further notice.
Please file feature requests and bugs at the issue tracker.