ResolvedHfModel class

A model resolved from a Hugging Face repo's deployment metadata into flutter_gemma's install + runtime vocabulary.

Install identity — modelType / fileType for FlutterGemma.installModel, and url for the download (install from url via fromNetwork so the resolver's revision is honoured; see url) — is kept apart from runtime, the overridable defaults the app applies at getActiveModel / createSession. That split mirrors how Hugging Face ships model identity (config.json) and generation defaults (generation_config.json) as separate files.

Constructors

ResolvedHfModel({required String file, required String url, required ModelFileType fileType, ModelType? modelType, String? sha256, int? sizeBytes, List<ResolvedHfFile>? files, String? directoryName, ModelRuntimeDefaults runtime = const ModelRuntimeDefaults(), List<String> notes = const []})
const

Properties

directoryName String?
For a DIRECTORY model: the single filesystem-safe subdirectory name the files install into. REQUIRED whenever files is non-null (the installer throws without it) and MUST include the resolved execution-provider variant (e.g. microsoft__Phi-3.5-mini-instruct-onnx__cpu_and_mobile) so two EP variants of the same repo never share a directory — build it with FileNameUtils.sanitizeHfDirName(repo, variant: …). Null for single-file.
final
file String
The variant filename chosen in the repo (e.g. model.litertlm). May contain / for a repo that nests variants in subfolders. Prefer url for the actual download — file is the variant's name / display value.
final
files List<ResolvedHfFile>?
For a DIRECTORY model (ORT-GenAI): every file that must be installed into the model's directory, each by its BARE leaf ResolvedHfFile.name. Null for a single-file model (.litertlm, .task) — that path installs url alone, unchanged. When non-null, file/url name the PRIMARY entry the engine loads from (for ORT-GenAI: genai_config.json) and that entry must also appear in this list.
final
fileType ModelFileType
How to install/route the model.
final
hashCode int
The hash code for this object.
no setterinherited
modelType ModelType?
The model family (gemmaIt/gemma4/qwen3/…), if the resolver can map the repo's declared architecture to one. Pass to FlutterGemma.installModel's required modelType. Null when the resolver can't determine it — the app must then supply it. Not cosmetic: ModelType drives runtime branching (tool-call format, thinking-tag handling).
final
notes List<String>
Advisory notes to surface (platform notes, known issues) — not acted on. Read-only; resolvers should pass an unmodifiable list.
final
runtime ModelRuntimeDefaults
The overridable runtime defaults (see ModelRuntimeDefaults).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sha256 String?
Manifest-declared integrity metadata (sha256 / size_bytes).
final
sizeBytes int?
final
url String
The authoritative download URL (…/resolve/<revision>/<file>) — the resolver builds it and MAY pin a non-main revision/commit for reproducibility. Install from this via installModel(...).fromNetwork(url) (the plugin still auto-applies the HF token to huggingface.co hosts); fromHuggingFace(repo, file:) rebuilds a main URL and so would drop a pinned revision.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited