Getting started
-
Add the package.
Terminal window flutter pub add transcribe_cppIt runs on iOS 16+ and Android 7+ (API 24, 64-bit). See Platforms for the details.
-
Let the app use the microphone and the network.
The package declares no permissions of its own. Your app asks for the microphone, and needs the network once, to download a model.
In
ios/Runner/Info.plist, say why you need the microphone. iOS shows this text in the permission prompt:<key>NSMicrophoneUsageDescription</key><string>Your speech is transcribed on this device.</string>In
android/app/src/main/AndroidManifest.xml, inside<manifest>:<uses-permission android:name="android.permission.RECORD_AUDIO"/><uses-permission android:name="android.permission.INTERNET"/>Debug builds add
INTERNETautomatically, so if you forget it, you will only find out in a release build. -
Download a model.
Models are not bundled with your app.
ModelManagerdownloads the one you ask for, checks it, and keeps it for next time:final models = await ModelManager.open();final model = await models.ensure(const ModelId('parakeet-tdt_ctc-110m-Q4_K_M'), // 90 MB, English);The first call downloads; after that it returns immediately. See Models for choosing one and showing progress.
-
Transcribe.
final session = await TranscribeSession.open(model);await session.start(); // asks for the microphone the first time// ...the user speaks; each sentence is transcribed when they pause...await session.stop(); // waits for the last sentenceawait session.dispose(); // when you no longer need the modelShow the text with a
ValueListenableBuilder. It updates as the user speaks:ValueListenableBuilder(valueListenable: session.text,builder: (context, text, _) => Text(text.full),)
Next steps
Section titled “Next steps”- Transcribing from the microphone: live text, sentences, interruptions and the permission prompt.
- Bringing your own audio: if your app already records audio.
- Listening in the background: keep transcribing after the user leaves the app.
- The example app: a complete app with a model picker.