resource_portable 2.1.6

Resource (portable) #

  • Note: This package is a portable (Web compatible) fork from original resource package.
  • The usage of this package should be the same of original resource package, beside import line.

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.


import 'package:resource_portable/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);

Learning more #

Please check out the API docs.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

2.1.6 #

  • Cast stream to List<int> in 'readAsString', this is in preparation for HttpClientResponse implementing Stream<Uint8List> (forward compatible change, should be a no-op for existing usages)

2.1.5 #

  • Require at least Dart 2.0.0-dev.61.

2.1.4 #

  • Require at least Dart 2.0.0.

2.1.3 #

  • Fix bug in readAsBytes which returned twice as much data as expected.

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

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

Use this package as a library

1. Depend on it

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

  resource_portable: ^2.1.6

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter 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_portable/resource.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/src/package_loader.dart.

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

Format lib/src/resolve_html.dart.

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

Format lib/src/resource.dart.

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

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and resource_portable.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
typed_data ^1.0.0 1.1.6
Dev dependencies
pedantic ^1.8.0
test ^1.0.0