You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build hooks and code assets support in Dart standalone is available since Dart 3.10.
Ongoing work for tree-shaking and other features related to hooks can be tracked in: Native Assets
This is a high level "feature" issue that we can refer to from various places.
The current way of bundling native code with Dart packages is far from ideal, we will introduce "Native Assets" to Dart.
Problem
As of right now, one can do one (or more) of the following:
ship sources in a Dart standalone package and let users run a build by calling dart run <your-package>/setup.dartsee webcrypto, or
make your bin/setup.dart download the native library, or
ship sources a flutter plugins with flutter create --template=plugin_ffi --platform=..., or
ship a script that downloads the native library during flutter build see realm_flutter.
This leads to pain for both package developers (options 1-4) and package users (option 1-2). Moreover, there is currently no way to make a package with native code that works both for flutter and Dart standalone.
High level solution
We introduce the concept of "Native Assets" to the Dart eco system.
A native asset is a native library (compiled from native source code).
Three components of the "Native Assets" solution in Dart:
A standardized way to build or download native assets. This will be done by a CLI.
A transparent way to find native symbols in these native assets in Dart.
Integration with all the dart and flutter tooling to link the above two together.
Try now
Native assets support in Dart standalone is available in Dart 3.2 behind an experimental flag : dart --enable-experiment=native-assets run [path/to/script.dart].
Native assets support in Flutter is in development. Progress can be tracked in flutter/flutter#129757.
An example on how to use native assets can be found here.
Build hooks and code assets support in Dart standalone is available since Dart 3.10.
Ongoing work for tree-shaking and other features related to hooks can be tracked in: Native Assets
This is a high level "feature" issue that we can refer to from various places.
The current way of bundling native code with Dart packages is far from ideal, we will introduce "Native Assets" to Dart.
Problem
As of right now, one can do one (or more) of the following:
dart run <your-package>/setup.dartsee webcrypto, orbin/setup.dartdownload the native library, orflutter create --template=plugin_ffi --platform=..., orThis leads to pain for both package developers (options 1-4) and package users (option 1-2). Moreover, there is currently no way to make a package with native code that works both for flutter and Dart standalone.
High level solution
We introduce the concept of "Native Assets" to the Dart eco system.
A native asset is a native library (compiled from native source code).
Three components of the "Native Assets" solution in Dart:
dartandfluttertooling to link the above two together.Try now
Native assets support in Dart standalone is available in Dart 3.2 behind an experimental flag :
dart --enable-experiment=native-assets run [path/to/script.dart].Native assets support in Flutter is in development. Progress can be tracked in flutter/flutter#129757.
An example on how to use native assets can be found here.
Checklist
FfiNatives #49803FfiNatives more concise #50097FfiNativefor static linking #49418FfiNativereturn types treatment inconsistent withasFunction#49518dart pub global run#56044--enable-experiment=native-assets)