InferenceInstallationBuilder class
Fluent builder for inference model installation
Provides type-safe API for installing inference models with optional LoRA weights. Automatically sets the installed model as the active inference model.
Usage:
await FlutterEdgeAi.installModel(
modelType: ModelType.gemmaIt,
)
.fromNetwork('https://example.com/model.task', token: 'hf_...')
.withProgress((progress) => print('$progress%'))
.install();
Constructors
- InferenceInstallationBuilder({required ModelType modelType, ModelFileType fileType = ModelFileType.task})
- Create builder with model identity
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fromAsset(
String path) → InferenceInstallationBuilder - Set model source from Flutter asset
-
fromBundled(
String resourceName) → InferenceInstallationBuilder - Set model source from bundled native resource
-
fromFile(
String path) → InferenceInstallationBuilder - Set model source from external file path
-
fromHuggingFace(
String repo, {String? file, String revision = 'main', String? token, bool? foreground}) → InferenceInstallationBuilder - Set model source from a Hugging Face repo. Two modes:
-
fromNetwork(
String url, {String? token, bool? foreground}) → InferenceInstallationBuilder - Set model source from network URL (HTTP/HTTPS)
-
install(
) → Future< InferenceInstallation> - Execute the installation and automatically set as active inference model
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withCancelToken(
CancelToken cancelToken) → InferenceInstallationBuilder - Set cancellation token for this installation
-
withLora(
ModelSource loraSource) → InferenceInstallationBuilder - Optional: Add LoRA weights from custom source
-
withLoraFromAsset(
String path) → InferenceInstallationBuilder - Convenience: Add LoRA weights from asset
-
withLoraFromBundled(
String resourceName) → InferenceInstallationBuilder - Convenience: Add LoRA weights from bundled resource
-
withLoraFromFile(
String path) → InferenceInstallationBuilder - Convenience: Add LoRA weights from file
-
withLoraFromNetwork(
String url, {String? token}) → InferenceInstallationBuilder - Convenience: Add LoRA weights from network URL
-
withProgress(
void onProgress(int progress)) → InferenceInstallationBuilder - Add progress callback
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited