Skip to content
pubscout

resource_portable

3.1.4, released 7 weeks ago by an unverified publisher

Read resource data and files in a portable way across VM, Web, and Flutter.

WASM-ready
$ flutter pub add resource_portable
Source repository

What it does

Allows loading runtime resource data identified by a URI (including package: URIs) as bytes or text. Serves as a web-compatible fork of the original resource package, supporting various platforms including Android, iOS, Web, Windows, macOS, and Linux.

AI-written summary of version 3.1.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to load static resource files or package assets consistently across VM and Web environments.
  • You are porting an existing codebase that relies on the classic 'resource' package to run on the web.

Skip it when

  • You are already using Flutter's built-in rootBundle asset loading and do not need cross-platform Dart VM compatibility.
  • You require complex asset management features specific to mobile or desktop platforms not covered by basic URI loading.

Strengths

  • Cross-platform compatibility (VM, Web, Flutter, and native).
  • Familiar API identical to the original resource package.

Weaknesses

  • Relies on specific platform configurations and custom path resolvers that might fail if asset paths or package URIs cannot be resolved.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
import 'dart:convert' show utf8;

import 'package:resource_portable/resource.dart' show Resource;

main() async {
  var resource = Resource("package:foo/foo_data.txt");
  var content = await resource.readAsString(encoding: utf8);
  print(content);
}

Alternatives

Packages that do the same job and could replace resource_portable.

  • package_config

    Read and write Dart package configuration files.

  • pool

    Manage a finite pool of resources to control concurrent operations.

  • exif_reader

    Decode EXIF metadata from various image formats in Dart, Web, and Flutter.

  • nmea

    Extensible NMEA0183 parser with checksum validation support for GPS devices and sensors.

Works with

Packages commonly used together with resource_portable: ones it builds on, ones built on it, and its own family.