resource 2.1.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 87

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

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
84 / 100
Health:
Code health derived from static analysis. [more]
97 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
79 / 100
Overall score:
Weighted score of the above. [more]
87
Learn more about scoring.

Platforms

Detected platforms: Flutter, other

Primary library: package:resource/resource.dart with components: isolate.

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.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 8 hints.

    Run dartfmt to format lib/src/io_io.dart.

    Run dartfmt to format lib/src/package_loader.dart.

    Similar analysis of the following files failed:

    • lib/src/resource.dart (hint)
    • lib/src/resource_loader.dart (hint)
  • 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