resource 2.1.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 94

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:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages 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';
        
Version Uploaded Documentation Archive
2.1.2 Feb 6, 2017 Go to the documentation of resource 2.1.2 Download resource 2.1.2 archive
2.1.1 Feb 1, 2017 Go to the documentation of resource 2.1.1 Download resource 2.1.1 archive
2.1.0 Jan 19, 2017 Go to the documentation of resource 2.1.0 Download resource 2.1.0 archive
2.0.2 Oct 7, 2016 Go to the documentation of resource 2.0.2 Download resource 2.0.2 archive
2.0.1 Sep 23, 2016 Go to the documentation of resource 2.0.1 Download resource 2.0.1 archive
2.0.0 Sep 23, 2016 Go to the documentation of resource 2.0.0 Download resource 2.0.0 archive
1.1.0 Jan 26, 2016 Go to the documentation of resource 1.1.0 Download resource 1.1.0 archive
1.0.1 Jan 21, 2016 Go to the documentation of resource 1.0.1 Download resource 1.0.1 archive
1.0.0 Jan 15, 2016 Go to the documentation of resource 1.0.0 Download resource 1.0.0 archive
0.0.0 Oct 6, 2015 Go to the documentation of resource 0.0.0 Download resource 0.0.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Jan 21, 2018
  • Dart: 2.0.0-dev.15.0
  • pana: 0.10.0

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
88 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
94

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:resource/resource.dart.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use resource.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.0 <2.0.0
typed_data ^1.0.0 1.1.5
Dev dependencies
test ^0.12.0