TtsInstallationBuilder class
Fluent builder for TTS (text-to-speech) model installation.
The model is a bundle of files (see TtsModelType.manifest) installed from
one base — fromNetwork, fromAsset, fromFile or fromBundled (the
last one called wins) — plus ofType. Automatically sets the installed
model as the active TTS model. TTS does not run on web, so install throws
UnsupportedError there.
Usage:
await FlutterEdgeAi.installTts()
.fromNetwork('https://example.com/matcha/', token: 'hf_...')
.ofType(TtsModelType.matcha)
.withProgress((p) => print('$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
-
fromAsset(
String directory) → TtsInstallationBuilder -
Flutter asset directory holding the bundle, laid out like the model's
Hugging Face repo: qwen3 keeps its
tables/andvoices/subdirectories, and Inflect's four reused Matcha G2P files sit next to its own two. -
fromBundled(
) → TtsInstallationBuilder -
Native bundled resources, one per manifest file, each named
<type>__<file>— e.g.matcha__config.json— because a bundled resource name is flat. Android reads them fromassets/models/in the APK and copies each into app storage once; iOS reads them in place from the app bundle. Android and iOS only. -
fromFile(
String directory) → TtsInstallationBuilder - Absolute directory on disk holding the bundle, laid out as for fromAsset. The files are used where they are, not copied, so the app must be allowed to read them; uninstalling the model leaves them there.
-
fromNetwork(
String baseUrl, {String? token}) → TtsInstallationBuilder - Base URL the bundle files live under (each manifest filename is appended to it to derive the per-file network source).
-
install(
) → Future< TtsInstallation> - Execute the installation and automatically set as active TTS model.
-
named(
String name) → TtsInstallationBuilder -
Override the installed spec's name. Defaults to
ttsModelType's name. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ofType(
TtsModelType ttsModelType) → TtsInstallationBuilder - Set the TTS model family (TtsModelType) this install represents.
-
toString(
) → String -
A string representation of this object.
inherited
-
withCancelToken(
CancelToken cancelToken) → TtsInstallationBuilder - Set cancellation token for this installation.
-
withProgress(
void cb(int overallPercent)) → TtsInstallationBuilder - Overall bundle install progress (0-100), across all manifest files.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited