core/model_management/model_specs library

Model specification value types — dart:io-free, shared across all platforms (mobile, desktop, web).

These types used to be part of flutter_gemma_mobile.dart, which pulled dart:io (and path_provider) into the public import graph and broke dart2wasm compatibility (pub.dev "Platform support" WASM check). They are extracted here as a standalone, platform-neutral library so the public API surface and the platform interface can depend on the specs without dragging in the mobile implementation's dart:io.

Classes

DownloadProgress
Progress information for model downloads
EmbeddingModelFile
Model file for embedding models (.bin files)
EmbeddingModelSpec
Specification for embedding models (model.bin + tokenizer.json)
EmbeddingTokenizerFile
Tokenizer file for embedding models (.json files)
InferenceModelFile
Model file for inference models (.bin, .task files)
InferenceModelSpec
Specification for inference models (main model + optional LoRA)
LoraModelFile
Model file for LoRA weights
ModelFile
Represents a single file that belongs to a model
ModelSpec
Base specification for any model (inference or embedding)
OrphanedFileInfo
Information about a potentially orphaned file
StorageStats
Storage statistics
SttModelFile
Model file for STT models (.tflite files)
SttModelSpec
Specification for STT models (model.tflite + tokenizer.json).
SttTokenizerFile
Tokenizer file for STT models (tokenizer.json)
TtsBundleFile
One file of a TTS model bundle. Keyed by its own filename so a bundle of N files gets N distinct prefsKeys (mirrors how the manager maps filePaths[file.prefsKey] = path).
TtsModelSpec
Specification for a TTS model — a SELECTABLE bundle. ttsModelType carries the model family so one generic backend dispatches to the right runtime profile; sources is one entry per file in that type's manifest.

Enums

ModelManagementType
Base enumeration for different model management types
ModelReplacePolicy
Policy for what happens to a previously-installed model when a new one is set active. Lives with the spec value types (it's a per-spec install policy); re-exported from model_file_manager_interface.dart for backward compat.
SttModelType
Speech-to-text model families supported by the pluggable STT backends. Only moonshine has a shipped SttModelProfile/pipeline (flutter_gemma_speech); the others are follow-ons that need a log-mel frontend.
TtsModelType
Text-to-speech model families supported by the pluggable TTS backends. Only matcha has a shipped TtsModelProfile/pipeline (flutter_gemma_speech); kokoro/supertonic are documented follow-ons (fail-loud until wired).

Extensions

TtsModelTypeManifest on TtsModelType
The filenames a given TTS model needs, installed together as a bundle from one source. Fail-loud for unwired families.

Exceptions / Errors

ModelDownloadException
Exception thrown when model download fails
ModelException
Base exception for model management operations
ModelStorageException
Exception thrown when model storage operations fail
ModelValidationException
Exception thrown when model file validation fails