Viewing version 0.20.0. Open the latest package page.
data_assets
0.20.0This library contains the hook protocol specification for bundling data assets with Dart packages.
Readme
package:data_assets Coverage Status pub package package publisher
A library to use in build hooks (hook/build.dart) for building and bundling
data assets.
A data asset is an asset bundled as data (String or bytes) with a Dart or Flutter application.
Data assets can be added in a build hook as follows:
import 'package:data_assets/data_assets.dart';
import 'package:hooks/hooks.dart';
void main(List<String> args) async {
await build(args, (input, output) async {
if (input.config.buildDataAssets) {
final packageName = input.packageName;
final assetPathInPackage = input.packageRoot.resolve('...');
final assetPathDownload = input.outputDirectoryShared.resolve('...');
output.assets.data.add(
DataAsset(
package: packageName,
name: '...',
file: assetPathInPackage,
),
);
}
});
}
For more documentation of hooks, refer to the API docs of
package:hooks.
Status: Experimental
NOTE: This package is currently experimental and published under the labs.dart.dev pub publisher in order to solicit feedback.
For packages in the labs.dart.dev publisher we generally plan to either graduate the package into a supported publisher (dart.dev, tools.dart.dev) after a period of feedback and iteration, or discontinue the package. These packages have a much higher expected rate of API and breaking changes.
Your feedback is valuable and will help us evolve this package. For bugs, please file an issue in the bug tracker.
Changelog
0.20.0
- Bumped dependency on
package:hooksto^2.0.0and implemented the newoutputFilesprotocol extension method to track generated data asset files for cache invalidation.
0.19.6
- Bump
package:hooksto 1.0.0.
0.19.5
- Document
input.packageRootin more places.
0.19.4
- Document that asset file paths must be absolute.
0.19.3
- Added a library comment detailing how to use the package.
0.19.2
- Bump
package:hooksto 0.20.0.
0.19.1
- Bump the SDK constraint to at least the one from
package:hooksto fix dartdoc generation on https://pub.dev.
0.19.0
- Split up
package:native_assets_cliinpackage:hooks,package:code_assets, andpackage:data_assets.
0.1.0
- Initial version.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'data_assets:0.20.0'pubspec.yaml
name: data_assets
description: >-
This library contains the hook protocol specification for bundling data assets
with Dart packages.
version: 0.20.0
repository: https://github.com/dart-lang/native/tree/main/pkgs/data_assets
topics:
- assets
- hooks
resolution: workspace
environment:
sdk: '>=3.10.0 <4.0.0'
dependencies:
hooks: ^2.0.0
dev_dependencies:
dart_flutter_team_lints: ^3.5.2
json_schema: ^5.2.0 # May only be used in tool/ and test/json_schema/.
native_test_helpers:
path: ../native_test_helpers
test: ^1.25.15
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0-wip | On demand | Download | e920d732…0f65cb |
| 0.19.0 | On demand | Download | b9b041af…1d86c8 |
| 0.19.1 | On demand | Download | 3421ffd6…92caae |
| 0.19.2 | On demand | Download | 275c19fb…761912 |
| 0.19.3 | On demand | Download | ecd26821…a0d6dd |
| 0.19.4 | On demand | Download | 8f673a09…0f0b93 |
| 0.19.5 | On demand | Download | 7354f454…d48f4e |
| 0.19.6 | On demand | Download | d8b93648…9245ba |
| 0.20.0 | Cached · Upstream SHA-256 matched | Download | 8bfdbf25…d71cae |
Dependencies
hooks "^2.0.0"