Skip to main content

Installation and platform setup

Requirements​

RuntimeMinimum
Flutter3.22
Dart3.4
AndroidAPI 21
iOS16
macOS14
Linux and WindowsNative Flutter build toolchain

Install​

flutter pub add kittentts

The package installs flutter_onnxruntime, path_provider, http, archive, and ffi. Do not register flutter_onnxruntime manually unless your application configures it directly.

Flutter Web​

Load ONNX Runtime Web before Flutter in web/index.html:

<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort.min.js"></script>
<script src="flutter_bootstrap.js" async></script>

Then run:

flutter run -d chrome

Web model paths resolve to Hugging Face by default. modelFiles may point to asset keys or HTTP URLs. The bundled JS/Emscripten CE runtime handles phonemization because Dart FFI cannot load the native bridge in a browser.

Smoke test​

final tts = await KittenTTS.create(
onProgress: (progress, info) {
print('${(progress * 100).round()}% ${info?.stage.name}');
},
);

final result = await tts.generate('Flutter setup is working.');
await tts.dispose();