native_structs library

Google's MediaPipe C structs that more than one family binds, from the release core pins for every family (family_runtimes.dart), and the helpers that fill and copy them. For the family packages' FFI bindings, whose ABI tests check every size and field offset against Google's wheel; not for applications.

Classes

MpBaseOptions
MpBaseOptions: the model, delegate and host every task's options embed.
MpCategory
MpCategory: one class and its score.
MpClassificationResult
MpClassificationResult: every head, with a timestamp.
MpClassifications
MpClassifications: one classifier head's categories.
MpClassifierOptions
MpClassifierOptions: the classifiers' result filtering.
MpEmbedding
MpEmbedding: one head's vector, as floats or quantized bytes.
MpEmbeddingResult
MpEmbeddingResult: every head, with a timestamp.

Functions

checkNativeStatus(int call(Pointer<Pointer<Char>> error), void errorFree(Pointer<Char> message), {Object failure(String message, int status)?}) → void
Runs call, one of Google's C functions that report a failure through an error out-parameter, and throws a failure as a TaskException with Google's message and status, or as what failure makes of them. errorFree is the calling family's MpErrorFree, since each family loads its own library; it frees Google's message on every path.
copyClassifications(MpClassificationResult result) → List<Classifications>
Copies every head of Google's result before Google frees it.
fillBaseOptions(MpBaseOptions target, Arena arena, {String? modelPath, Uint8List? modelBytes, Delegate delegate = Delegate.cpu}) → void
Fills Google's base options for delegate, the CPU unless a task has proved its GPU path, with the model at modelPath or in modelBytes (or none, for a task such as Semantic Retriever that loads no model), and the host as Flutter on this OS, with mpHostVersion, which Google's usage log records (it records neither while the environment is unknown), and the app as mpAppId and mpAppVersion, where there are any. Bytes and strings are copied into arena, which may free them once the task exists: Google copies them when it creates the task.
fillClassifierOptions(MpClassifierOptions target, Arena arena, ClassifierSettings settings) → void
Fills Google's classifier options from settings, every string in arena.
nativeString(Pointer<Char> value, {bool emptyIsNull = false}) → String?
Copies Google's C string, or null for a null pointer. With emptyIsNull, an empty string is null too, as Google's Python reads optional strings.
nativeStrings(Arena arena, List<String> values) → Pointer<Pointer<Char>>
Copies values into a C string array in arena, or null when there are none.