flutter_ai_voice 0.1.4 copy "flutter_ai_voice: ^0.1.4" to clipboard
flutter_ai_voice: ^0.1.4 copied to clipboard

Speech-to-text contracts and models for flutter_ai: a batch-first SpeechToText interface, transcript models, and a callback adapter for pluggable engines.

flutter_ai_voice

Speech-to-text contracts for flutter_ai — engine-agnostic STT models behind the animated live orb. Bring on-device Whisper, a cloud API, or the platform recognizer.

Live voice mode with an animated orb

flutter_ai_voice on pub.dev pub points License: BSD-3-Clause

Family: flutter_ai · core · client · elements · tools · mcp
Recipes · Migrating from the Vercel AI SDK

The orb lives in flutter_ai_elements (AiLiveSession); this package is the STT contract behind it.


Speech-to-text contracts and models for the flutter_ai family. Dependency-free; concrete engines plug in behind the interface.

Scope — what this package is not #

This package is speech-to-text contracts only. So you know up front, it does not include:

  • No audio capture / recording. You record the audio (e.g. with record, flutter_sound, or the platform mic) and hand the bytes/file to a SpeechToText.
  • No text-to-speech (TTS). Nothing here speaks responses aloud. Wire a TTS engine yourself (e.g. flutter_tts) and drive the onSpeak hook on AiMessageActions.
  • No bundled STT engine. SpeechToText is an interface — bring on-device Whisper, a cloud API, or the platform recognizer.
  • AiLiveSession (in flutter_ai_elements) is presentational. The orb, transcript, and amplitude reaction are UI; you connect the mic + a SpeechToText behind it.
  • transcribeStream is best-effort, not true live STT. CallbackSpeechToText in particular buffers the whole stream in memory and emits nothing until it closes — see its dartdoc. Prefer the record-then-transcribe flow below.

Why batch-first #

Native OS speech recognition has awkward limits (iOS cuts off after ~1 minute), so the reliable flow is: record → transcribe a finished buffer → send the text. Continuous transcribeStream is offered for live captions but is best-effort.

API #

  • SpeechToTexttranscribeBytes, transcribeFile, transcribeStream.
  • Transcript / TranscriptSegment / TranscriptPartial — result models.
  • CallbackSpeechToText — wrap any transcribe function without a full class.

Usage #

import 'package:flutter_ai_voice/flutter_ai_voice.dart';

// Adapt any engine (on-device Whisper, a cloud API, …) in one line:
final stt = CallbackSpeechToText(
  transcribe: (audio, {mediaType, language}) => myWhisper.run(audio),
);

final transcript = await stt.transcribeBytes(recordedBytes);
controller.sendText(transcript.text); // feed into flutter_ai_client

Plugging in a real engine #

Implement SpeechToText directly, or pass a function to CallbackSpeechToText. On-device options like whisper_ggml/whisper_kit and cloud services are intentionally not dependencies here, so the package stays light — wire your chosen engine in the host app or a dedicated adapter package.

Status #

Interface + models + callback adapter, fully unit-tested. No concrete audio engine, recording, or TTS ships in this package (see Scope above). See the CHANGELOG for version history.

☕ Support this project #

Buy me a coffee on Ko-fi

If flutter_ai saves you time, buy me a coffee ☕ — it keeps the whole family maintained.

0
likes
160
points
50
downloads

Documentation

API reference

Publisher

verified publishermouazanan.dev

Weekly Downloads

Speech-to-text contracts and models for flutter_ai: a batch-first SpeechToText interface, transcript models, and a callback adapter for pluggable engines.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ai #speech-to-text #voice #transcription #flutter

License

BSD-3-Clause (license)

More

Packages that depend on flutter_ai_voice