native_assets library

Build-time helpers for downloading and bundling pinned MediaPipe libraries. Import this library from hooks, not from application code.

Classes

DownloadAsset
A reviewed download. Every location must serve the same pinned bytes.
DownloadFailure
One unsuccessful source.
FamilyRuntime
One of Google's files, exactly as Google ships it.

Constants

familyRuntimeArchiveUrl → const String
Google's archive of the November 2, 2026 build, where the hooks download Google's libraries: each one is read from it with HTTP range requests, without the rest of the archive.
familyRuntimeAssetName → const String
The name each task family binds its own MediaPipe library under: package:mediapipe_vision/mediapipe.dylib, package:mediapipe_text/... and package:mediapipe_audio/....
familyRuntimeMinimumAndroidApi → const int
The lowest Android API level Google's Android libraries load on: they are built for Android 9.
familyRuntimes → const Map<String, Map<String, FamilyRuntime>>
Google's per-family libraries, by family and build target.
familyRuntimeVersion → const String
Google's MediaPipe build that names the mirror release holding the libraries: the 1.2.2 release build of November 2, 2026.

Functions

buildTarget(CodeConfig code) → String
The build target a hook produces assets for: macos/arm64, ios-simulator/arm64, ios/arm64, linux/x64, windows/arm64, and so on.
bundleFamilyRuntime(BuildInput input, BuildOutputBuilder output, {required String family}) → Future<void>
Bundles family's library for the hook's target under familyRuntimeAssetName, in the calling family's package: Google's per-family library (familyRuntimes).
downloadVerified(DownloadAsset asset, File destination, {Client? client, String? source}) → Future<File>
Downloads asset atomically, reusing an existing file only if its hash matches. A failed download never replaces an existing destination.
hookAssetSource(BuildInput input) → String?
Where build hooks fetch pinned assets instead of their URLs, for offline and mirrored builds: hooks.user_defines.mediapipe_core.asset_source, a directory (relative to the app's pubspec) or an http(s) root holding files named by their SHA-256.
requireDynamicLinking(CodeConfig code) → void
Rejects static linking, which no MediaPipe runtime supports.
requireFamilyRuntime(String family, String target) → FamilyRuntime
family's library for target, or an UnsupportedError naming the targets that have one.

Exceptions / Errors

DownloadException
Every source failed to provide the pinned bytes.