MobileModelManager class

Main unified model manager that orchestrates all model operations

Inheritance

Constructors

MobileModelManager.new()

Properties

currentActiveModel ModelSpec?
Gets the currently active model specification
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearModelCache() Future<void>
Clears current model cache/state
override
deleteCurrentModel() Future<void>
Deletes current active model (legacy method without parameters)
override
deleteLoraWeights() Future<void>
Removes LoRA weights from current model
override
deleteModel(ModelSpec spec) Future<void>
Deletes a model and all its files
override
downloadModel(ModelSpec spec, {String? token}) Future<void>
Downloads a model without progress tracking
override
downloadModelWithProgress(ModelSpec spec, {String? token}) Stream<DownloadProgress>
Downloads a model with progress tracking
override
ensureModelReady(String filename, String url) Future<void>
Ensures a model is ready for use, handling all necessary operations
override
getInstalledModels(ModelManagementType type) Future<List<String>>
Gets all installed models for a specific type
override
getModelFilePaths(ModelSpec spec) Future<Map<String, String>?>
Gets the file paths for an installed model
override
getStorageStats() Future<Map<String, int>>
Gets storage statistics
override
initialize() Future<void>
Initializes the unified model manager
installModelFromAsset(String path, {String? loraPath}) Future<void>
Installs model from Flutter assets (debug only)
override
installModelFromAssetWithProgress(String path, {String? loraPath}) Stream<int>
Installs model from Flutter assets with progress tracking (debug only)
override
isAnyModelInstalled(ModelManagementType type) Future<bool>
Checks if ANY model of the given type is installed
override
isModelInstalled(ModelSpec spec) Future<bool>
Checks if a model is installed and valid
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performCleanup() Future<void>
Performs cleanup of orphaned files
override
setLoraWeightsPath(String path) Future<void>
Sets path to LoRA weights for current model
override
setModelPath(String path, {String? loraPath}) Future<void>
Sets direct path to existing model files
override
toString() String
A string representation of this object.
inherited
validateModel(ModelSpec spec) Future<bool>
Validates all files for a model specification
override

Operators

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

Static Methods

createEmbeddingSpec({required String name, required String modelUrl, required String tokenizerUrl, ModelReplacePolicy replacePolicy = ModelReplacePolicy.keep}) EmbeddingModelSpec
Creates an embedding model specification from parameters
createInferenceSpec({required String name, required String modelUrl, String? loraUrl, ModelReplacePolicy replacePolicy = ModelReplacePolicy.replace}) InferenceModelSpec
Creates an inference model specification from parameters