File tree Expand file tree Collapse file tree 8 files changed +62
-0
lines changed
pkgs/native_assets_builder Expand file tree Collapse file tree 8 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
- Use ` HookConfig.targetIosSdk ` and ` HookConfig.targetMacosSdk ` optional
4
4
values, and add examples to fail builds based on this.
5
+ - Add data asset test project.
5
6
6
7
## 0.7.0
7
8
Original file line number Diff line number Diff line change 84
84
- simple_link/hook/build.dart
85
85
- simple_link/hook/link.dart
86
86
- simple_link/pubspec.yaml
87
+ - simple_data_asset/pubspec.yaml
88
+ - simple_data_asset/asset/test_asset.txt
89
+ - simple_data_asset/README.md
90
+ - simple_data_asset/hook/build.dart
91
+ - simple_data_asset/bin/simple_data_asset.dart.debug
87
92
- some_dev_dep/bin/some_dev_dep.dart
88
93
- some_dev_dep/pubspec.yaml
89
94
- wrong_build_output_2/hook/build.dart
Original file line number Diff line number Diff line change
1
+ # https://dart.dev/guides/libraries/private-files
2
+ # Created by `dart pub`
3
+ .dart_tool /
4
+ bin /simple_data_asset /
Original file line number Diff line number Diff line change
1
+ This sample adds and retrieves a data asset.
Original file line number Diff line number Diff line change
1
+ World!
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+ import 'dart:asset';
5
+
6
+ Future<void> main(List<String> args) async {
7
+ print('Hello ${await getWorld()}');
8
+ }
9
+
10
+ Future<String> getWorld() async {
11
+ const asset = ByteAsset('package:simple_data_asset/assetId');
12
+ final byteBuffer = await asset.load();
13
+ return String.fromCharCodes(byteBuffer.asUint8List());
14
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+ import 'package:native_assets_cli/native_assets_cli.dart' ;
5
+
6
+ void main (List <String > args) => build (
7
+ args,
8
+ (config, output) async {
9
+ output.addAsset (
10
+ DataAsset (
11
+ package: config.packageName,
12
+ name: 'assetId' ,
13
+ file: config.packageRoot.resolve ('asset/test_asset.txt' ),
14
+ ),
15
+ );
16
+ output.addDependency (config.packageRoot.resolve ('hook/build.dart' ));
17
+ },
18
+ );
Original file line number Diff line number Diff line change
1
+ name : simple_data_asset
2
+ description : Add and retrieve a data asset.
3
+ version : 1.0.0
4
+
5
+ publish_to : none
6
+
7
+ environment :
8
+ sdk : ^3.0.0
9
+
10
+ dependencies :
11
+ logging : ^1.1.1
12
+ # native_assets_cli: ^0.6.0
13
+ native_assets_cli :
14
+ path : ../../../native_assets_cli/
15
+
16
+ dev_dependencies :
17
+ lints : ^3.0.0
18
+ test : ^1.24.0
You can’t perform that action at this time.
0 commit comments