MobileModelManager class

Main unified model manager that orchestrates all model operations

Inheritance

Constructors

MobileModelManager.new()

Properties

activeEmbeddingModel ModelSpec?
Gets the currently active embedding model specification
no setteroverride
activeInferenceModel ModelSpec?
Gets the currently active inference model specification
no setteroverride
currentActiveModel ModelSpec?
Gets the currently active model specification (backward compatibility)
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

cleanupStorage() Future<int>
Clean up orphaned files
override
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>
Legacy API: Ensures a model is ready for use
override
ensureModelReadyFromSpec(ModelSpec spec) Future<void>
Modern API: Ensures a model spec is ready for use
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
getOrphanedFiles() Future<List<OrphanedFileInfo>>
Get information about orphaned files
override
getStorageInfo() Future<StorageStats>
Get storage statistics with orphaned file information
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
setActiveModel(ModelSpec spec) → void
Sets the active model for subsequent operations
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

createBundledEmbeddingSpec({required String modelResourceName, required String tokenizerResourceName, ModelReplacePolicy replacePolicy = ModelReplacePolicy.keep}) EmbeddingModelSpec
Creates a bundled embedding model specification (for production builds)
createBundledInferenceSpec({required String resourceName, String? loraResourceName, ModelReplacePolicy replacePolicy = ModelReplacePolicy.replace}) InferenceModelSpec
Creates a bundled inference model specification (for production builds)
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