templates/native_assets_templates library

Constants

nativeAssetsHookDeps → const Map<String, String>
The hook's dependencies the consuming plugin must declare (build-time). They live in regular dependencies (NOT dev_dependencies) so that packages depending on this plugin resolve them when running the build hook.
nativeAssetsVendoredCSources → const List<String>
nitro C-runtime sources the hook compiles alongside the bridge (vendored into the plugin's src/nitro_native/ at link time — the DL API provides Dart_InitializeApiDL / Dart_PostCObject_DL the async/stream paths need).
nativeAssetsVendoredHeaders → const List<String>
Headers vendored next to nativeAssetsVendoredCSources so the bridge + dart_api_dl.c compile (header-only nitro runtime + the Dart API headers).

Functions

buildExternalCmakeHookDart({required String libStem, required String pkg, String cmakeSrcDir = 'src'}) → String
hook/build.dart for a plugin with its own cmake project (cmakeSrcDir): drives that build and declares the produced library as the [libStem] code asset. The CodeAsset name is the OS-independent lib stem (matching @Native(assetId: 'package:[pkg]/[libStem]')), and the cmake target's output name must be libStem. Cross-compiles via cmake's own toolchain vars derived from the build config (NDK toolchain file / CMAKE_SYSTEM_NAME=iOS / OSX arch); external deps are the plugin cmake's job. NITRO_CMAKE_ARGS (a ;-delimited env list) forwards extra configure args for prebuilt dep roots.
buildHookDart({required List<NativeAssetsModule> modules, String vendoredDir = 'src/nitro_native'}) → String
Contents of hook/build.dart — one CBuilder.library per modules entry (multi-module plugins build one code asset each; each module's generated Dart resolves against its own asset). The vendored Dart DL API in vendoredDir is compiled into every asset.

Typedefs

NativeAssetsModule = ({List<String> cppSources, String libStem})
One C++ module → one code asset. libStem is the sanitized module name (asset id package:$pkg/$libStem, matching the generated @Native bindings); cppSources are the generated bridge + the impl.