Installation and platform setup
Requirements
| Runtime | Minimum |
|---|---|
| Flutter | 3.22 |
| Dart | 3.4 |
| Android | API 21 |
| iOS | 16 |
| macOS | 14 |
| Linux and Windows | Native 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();