resource 2.1.2

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(encoding: UTF8);
  print(string);
}

Learning more

Please check out the API docs.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

2.1.2

  • Fix bug in readAsString when charset is LATIN-1 and content-length is set.

2.1.1

  • Reduce max concurrent connections to the same host to 6 when using dart:io. That's the same limit that many browsers use.
  • Trying to load a resource from a non-existing package now gives a better error message.

2.1.0

  • Make failing HTTP requests throw an HttpException.

2.0.2

  • Update README.md.

2.0.1

  • Fix type warnings.

2.0.0

  • Use configuration dependent imports to avoid having separate implementations for dart:io and dart:html.
  • Remove browser_resource.dart.

1.1.0

  • Added browser-compatible version as browser_resource.dart library. Only needed because configurable imports are not available yet.

1.0.0

  • Initial version

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  resource: "^2.1.2"

2. Install it

You can install packages from the command line:

$ pub get

Alternatively, your editor might support 'pub get'. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:resource/resource.dart';

About

Reading resource data from (package and other) files.

Author

Email misc@dartlang.org Dart Team

Homepage

github.com/dart-lang/resource

Documentation

www.dartdocs.org/documentation/resource/2.1.2/

Source code (hyperlinked)

www.crossdart.info/p/resource/2.1.2/

Uploader

sethladd@google.com
lrn@google.com

Share