ModelDownloader class

Standalone model downloader for sherpa-onnx ASR models.

Downloads model files (ONNX + tokens) from HTTP URLs to a local directory. Download state is determined by model file existence.

Usage:

final downloader = ModelDownloader();

// Check if downloaded
final downloaded = await downloader.isDownloaded();

// Download with progress
await downloader.download(
  urls: {'model.int8.onnx': 'https://...', 'tokens.txt': 'https://...'},
  onProgress: (fileName, percent) { ... },
);

Constructors

ModelDownloader({AsrModelResourceConfig resourceConfig = const AsrModelResourceConfig()})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
resourceConfig AsrModelResourceConfig
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearDownloaded() Future<void>
Remove legacy marker file from older versions.
download({required Map<String, String> urls, required void onProgress(String fileName, int percent)}) Future<void>
Download model files from urls.
getModelPath(String fileName) Future<String>
Returns the full path for a model file name in the models directory.
getModelsDirPath() Future<String>
isDownloaded({List<String>? requiredFiles}) Future<bool>
Checks whether model files have been completely downloaded.
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