|
1 |
| -The examples in this folder illustrate how native code is built and bundled |
2 |
| -in Dart and Flutter apps. |
3 |
| - |
4 |
| -* [native_add_app/](native_add_app/) has a dependency with C code. |
5 |
| - This app should declare nothing special. Dart and Flutter should check |
6 |
| - all dependencies for native code. |
7 |
| -* [native_add_library/](native_add_library/) contains a library with C code. |
8 |
| - When Dart code in this library or dependent on this library is invoked, the |
9 |
| - C code must be built and bundled so that it can be used by the Dart code. |
| 1 | +The examples in this folder illustrate how assets are built and bundled in Dart |
| 2 | +and Flutter apps. |
| 3 | + |
| 4 | +Currently two main asset types are supported in `package:native_assets_cli`: |
| 5 | + * Native libraries |
| 6 | + * Data assets |
| 7 | + |
| 8 | +Note that Data assets are not yet consumable in Dart and Flutter. |
| 9 | + |
| 10 | +Examples: |
| 11 | + |
| 12 | +* Bundling C/C++/Objective-C source code in a package. This native code is built on the developers' machine when such package is a dependency. |
| 13 | + * [native_add_library/](native_add_library/) contains a library with C code. |
| 14 | + When Dart code in this library or dependent on this library is invoked, the |
| 15 | + C code must be built and bundled so that it can be used by the Dart code. |
| 16 | + * [native_add_app/](native_add_app/) has a dependency with C code. |
| 17 | + This app should declare nothing special. Dart and Flutter should check |
| 18 | + all dependencies for native code. |
| 19 | +* Bundling prebuilt native libaries. |
| 20 | + * [download_asset/](download_asset/) is very similar to |
| 21 | + [native_add_library/](native_add_library/), but instead of building the |
| 22 | + native code on the machine of developers pulling in the package, the native |
| 23 | + libraries are prebuilt in GitHub actions and downloaded in the build hook. |
| 24 | +* Bundling multiple dynamic libraries depending on each other. |
| 25 | + * [native_dynamic_linking/](native_dynamic_linking/) contains source code for |
| 26 | + 3 native libraries that depend on each other and load each other with the |
| 27 | + native dynamic loader at runtime. |
| 28 | +* Building dynamic libraries against `dart_api_dl.h`. |
| 29 | + * [use_dart_api/](use_dart_api/) contains a library with C code that invokes |
| 30 | + `dart_api_dl.h` to interact with the Dart runtime. |
| 31 | +* Bundling all files in a directory as data assets. |
| 32 | + * [local_asset/](local_asset/) contains a package that bundles all files in |
| 33 | + the `assets/` directory as data assets. |
| 34 | +* Transforming files and bundling them as data assets. |
| 35 | + * [transformer/](../../../native_assets_builder/test_data/transformer/README.md) |
| 36 | + contains a package that transforms files and bundles the result as data |
| 37 | + assets. The hook uses caching internally to prevent retransforming files if |
| 38 | + not needed. |
0 commit comments