Clone this repo:

Branches

  1. da5c201 Update README.md by John Messerly · 5 months ago master
  2. 14b94b7 fix analyzer warnings in tests by Kevin Moore · 6 months ago
  3. ac8c91e Fix library name of browser_resource by Kevin Moore · 6 months ago
  4. 2344bf9 add code review settings by Kevin Moore · 6 months ago
  5. a49101b Merge pull request #11 from dart-lang/sethladd-patch-1 by Seth Ladd · 6 months ago

Resource

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);
}

Learning more

Please check out the API docs.

Features and bugs

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.