package:native_assets_cli Coverage Status pub package package publisher

This library contains the CLI specification and a default implementation for bundling native code with Dart packages.

Status: Experimental

NOTE: This package is currently experimental and published under the pub publisher in order to solicit feedback.

For packages in the publisher we generally plan to either graduate the package into a supported publisher (, 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. For general feedback and suggestions for the native assets feature in Dart and Flutter, please comment in dart-lang#50565 or flutter#129757.


A typical layout of a package with native code is:

  • lib/ contains Dart code which uses dart:ffi and package:ffigen to call into native code.
  • src/ contains C/C++/Rust code which is invoked through dart:ffi.
  • hook/build.dart implements the CLI that communicates which native assets to build/bundle with the Dart/Flutter SDK. This file uses the protocol specified in this package.

Example can be found in example/build/.


Using the native assets feature requires passing --enable-experiment=native-assets in Dart on a dev build.

The native assets feature is not yet available in Flutter.


The development of the feature can be tracked in dart-lang#50565, flutter#129757, and in the issue tracker on this repository.


A library that contains the argument and file formats for implementing a build hook (hook/build.dart).