SttInstallationBuilder class
Fluent builder for STT (speech-to-text) model installation
Provides type-safe API for installing STT models (requires model + tokenizer). Automatically sets the installed model as the active STT model.
The model is SELECTABLE like inference models: ofType is required so the installed SttModelSpec carries an SttModelType (mirrors InferenceModelSpec.modelType) — a single generic backend can then dispatch to the right runtime profile instead of hardcoding one model.
Usage:
await FlutterEdgeAi.installStt()
.modelFromNetwork('https://example.com/model.tflite', token: 'hf_...')
.tokenizerFromNetwork('https://example.com/tokenizer.json', token: 'hf_...')
.ofType(SttModelType.moonshine)
.withModelProgress((p) => print('Model: $p%'))
.withTokenizerProgress((p) => print('Tokenizer: $p%'))
.install();
Constructors
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
-
fromCatalog(
SttVariant variant, {String? token}) → SttInstallationBuilder - Install a model registry build: its pinned model and tokenizer URLs, its type and sizes. The sizes are checked before the model becomes active (not on the web), and withProgress weights by them without asking the network.
-
install(
) → Future< SttInstallation> - Execute the installation and automatically set as active STT model
-
modelFromAsset(
String path) → SttInstallationBuilder - Set model source from Flutter asset
-
modelFromBundled(
String resourceName) → SttInstallationBuilder - Set model source from bundled native resource
-
modelFromFile(
String path) → SttInstallationBuilder - Set model source from external file path
-
modelFromNetwork(
String url, {String? token, int? expectedSize}) → SttInstallationBuilder - Set model source from network URL (HTTP/HTTPS)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ofType(
SttModelType sttModelType) → SttInstallationBuilder - Set the STT model family (SttModelType) this install represents.
-
tokenizerFromAsset(
String path) → SttInstallationBuilder - Set tokenizer source from a Flutter asset.
-
tokenizerFromBundled(
String resourceName) → SttInstallationBuilder - Set tokenizer source from a bundled native resource.
-
tokenizerFromFile(
String path) → SttInstallationBuilder - Set tokenizer source from an external file path.
-
tokenizerFromNetwork(
String url, {String? token, int? expectedSize}) → SttInstallationBuilder - Set tokenizer source from network URL (HTTP/HTTPS).
-
toString(
) → String -
A string representation of this object.
inherited
-
withCancelToken(
CancelToken cancelToken) → SttInstallationBuilder - Set cancellation token for this installation
-
withModelProgress(
void onProgress(int progress)) → SttInstallationBuilder - Add model file progress callback
-
withProgress(
void onProgress(int progress)) → SttInstallationBuilder -
Progress of the whole install, 0 to 100, by bytes across the model and
its tokenizer, as
TtsInstallationBuilder.withProgresscounts: sizes read before the first download (a HEAD request per network file unless itsexpectedSizeis set, none on the web; the disk for files installed already), files installed already counted from the start, every file the same weight when a size is unknown. Values only rise, and a successful install ends with 100 once the model is active. -
withTokenizerProgress(
void onProgress(int progress)) → SttInstallationBuilder - Add tokenizer file progress callback
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited