ModelLoader class
A utility class for loading models from the assets or the internet. Models are loaded in separate isolates.
Constructors
- ModelLoader({String? modelStorage, AssetBundle? assetBundle, Client? httpClient})
-
Create a new instance of model loader with an optional
modelStorage.
Properties
- assetBundle → AssetBundle?
-
Asset bundle used to load models from assets.
When the value is null, rootBundle is used.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClient ↔ Client
-
Http client used to make network requests.
latefinal
- modelStorage → String?
-
The path where the models loaded by this model loader will be located.
If not specified
_defaultDecompressionPathis used.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isModelAlreadyLoaded(
String modelName) → Future< bool> -
Check if the model with the
modelNameis already loaded. -
loadFromAssets(
String asset, {bool forceReload = false}) → Future< String> - Load a model from the app assets. Returns the path to the loaded model.
-
loadFromNetwork(
String modelUrl, {bool forceReload = false}) → Future< String> - Load a model from the network.
-
loadModelsList(
) → Future< List< LanguageModelDescription> > - Load a list of all available models from the vosk lib web page.
-
modelPath(
String modelName) → Future< String> - Get the storage path of the loaded model.
-
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