-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add data asset test project * Change description * Fix gitignore * Add readme * Rename to .txt * Use .debug instead * update manifest
- Loading branch information
Showing
8 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
pkgs/native_assets_builder/test_data/simple_data_asset/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# https://dart.dev/guides/libraries/private-files | ||
# Created by `dart pub` | ||
.dart_tool/ | ||
bin/simple_data_asset/ |
1 change: 1 addition & 0 deletions
1
pkgs/native_assets_builder/test_data/simple_data_asset/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This sample adds and retrieves a data asset. |
1 change: 1 addition & 0 deletions
1
pkgs/native_assets_builder/test_data/simple_data_asset/asset/test_asset.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
World! |
14 changes: 14 additions & 0 deletions
14
pkgs/native_assets_builder/test_data/simple_data_asset/bin/simple_data_asset.dart.debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
import 'dart:asset'; | ||
|
||
Future<void> main(List<String> args) async { | ||
print('Hello ${await getWorld()}'); | ||
} | ||
|
||
Future<String> getWorld() async { | ||
const asset = ByteAsset('package:simple_data_asset/assetId'); | ||
final byteBuffer = await asset.load(); | ||
return String.fromCharCodes(byteBuffer.asUint8List()); | ||
} |
18 changes: 18 additions & 0 deletions
18
pkgs/native_assets_builder/test_data/simple_data_asset/hook/build.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
import 'package:native_assets_cli/native_assets_cli.dart'; | ||
|
||
void main(List<String> args) => build( | ||
args, | ||
(config, output) async { | ||
output.addAsset( | ||
DataAsset( | ||
package: config.packageName, | ||
name: 'assetId', | ||
file: config.packageRoot.resolve('asset/test_asset.txt'), | ||
), | ||
); | ||
output.addDependency(config.packageRoot.resolve('hook/build.dart')); | ||
}, | ||
); |
18 changes: 18 additions & 0 deletions
18
pkgs/native_assets_builder/test_data/simple_data_asset/pubspec.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: simple_data_asset | ||
description: Add and retrieve a data asset. | ||
version: 1.0.0 | ||
|
||
publish_to: none | ||
|
||
environment: | ||
sdk: ^3.0.0 | ||
|
||
dependencies: | ||
logging: ^1.1.1 | ||
# native_assets_cli: ^0.6.0 | ||
native_assets_cli: | ||
path: ../../../native_assets_cli/ | ||
|
||
dev_dependencies: | ||
lints: ^3.0.0 | ||
test: ^1.24.0 |