SDKsFlutterEnterprise
Transcribe audio
Use the Flutter SDK to transcribe text from a local audio file.
Upload a local audio file to the speech recognition service and retrieve the transcribed text:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
filename | String | Yes | Absolute local filesystem path to the audio file readable on the current device. |
Code example
final result = await OpenIM.iMManager.messageManager.speechToText(
filename: soundElem.soundPath!,
);
final transcript = result.text ?? '';Return value
Returns a Future resolving to a speech-to-text response (SpeechToTextResp). Retrieve the transcribed string via its text field.
State changes after the call
This method only executes speech recognition; it does not modify the message object or trigger event callbacks. If a voice message only has a remote URL, download it to local application storage before transcribing. Before invoking transcription, verify service availability using Check speech recognition support. To store the transcribed text in the local message, see Save a local transcript.
Was this page helpful?