Type less, talk more. That is where a lot of mobile apps are heading, especially for tasks like search, form filling, or quick commands. If you have been wondering how to bring that into your own product, building voice assistants in Flutter apps is more approachable than most developers expect. You don’t need a research team or a custom speech model to get a working voice feature into your app.
This guide walks through the full process: what a voice assistant in a Flutter app actually needs, which packages to use, and how to put the pieces together step by step.
What a Voice Assistant in a Flutter App Actually Needs
Before writing any code, it helps to break the feature into its real parts. A basic voice assistant needs four things:
- Microphone access to capture what the user says
- Speech-to-text conversion to turn audio into readable text
- Some logic to decide what to do with that text (a command, a search query, a question for an AI model)
- Text-to-speech output if the assistant needs to talk back
Flutter does not include any of this out of the box, but the plugin ecosystem covers all four parts well. You are mostly assembling existing tools rather than building speech recognition from scratch.
Step 1: Set Up Your Flutter Project and Permissions
Start with a working Flutter project, then add the packages you need to your pubspec.yaml:
dependencies:
speech_to_text: ^7.3.0
flutter_tts: ^4.0.0
permission_handler: ^11.0.0
Microphone access requires a runtime permission on both Android and iOS, so add the right entries before writing any listening code.
For Android, add this to AndroidManifest.xml:
<uses-permission android:name=”android.permission.RECORD_AUDIO” />
<uses-permission android:name=”android.permission.INTERNET” />
For iOS, add these to Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access for voice commands.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This app uses speech recognition to understand voice commands.</string>
Skipping this step is the most common reason a voice feature fails silently on a real device during testing.
Step 2: Add Speech-to-Text Recognition
The speech_to_text package is the standard choice for turning spoken words into text in a Flutter app. It uses the device’s own speech recognition engine, so there is no separate API key needed for basic use, and it supports Android, iOS, macOS, and web<cite index=”52-1″>.</cite> Keep in mind that it is built for short commands and phrases rather than long, continuous dictation<cite index=”52-1″>.</cite>
Here is a simple setup:
import ‘package:speech_to_text/speech_to_text.dart’ as stt;
class VoiceService {
final stt.SpeechToText _speech = stt.SpeechToText();
bool _isListening = false;
Future<bool> initialize() async {
return await _speech.initialize();
}
void startListening(Function(String) onResult) {
_speech.listen(
onResult: (result) => onResult(result.recognizedWords),
);
_isListening = true;
}
void stopListening() {
_speech.stop();
_isListening = false;
}
}
A few practical details worth knowing:
- On Android, the system stops listening quickly after a short pause, and there is no supported way to change that timing<cite index=”52-1″>.</cite>
- Use partialResults if you want the text to update live as the user speaks, rather than waiting for them to finish.
- Always check isAvailable() before starting a listening session, since speech recognition support can vary by device.
Step 3: Add Text-to-Speech for Spoken Responses
If your assistant needs to talk back, flutter_tts handles that side of things. It works across iOS, Android, web, macOS, and Windows<cite index=”60-1″>.</cite>
import ‘package:flutter_tts/flutter_tts.dart’;
class SpeechOutput {
final FlutterTts _tts = FlutterTts();
Future<void> speak(String text) async {
await _tts.setLanguage(“en-US”);
await _tts.setSpeechRate(0.5);
await _tts.speak(text);
}
}
You can adjust the pitch, speed, and volume, and check whether a specific language is available on the device before speaking<cite index=”60-1″>.</cite> If your app supports Hindi or other regional languages alongside English, test the available voices on real devices, since language support depends on what the operating system provides, not on the plugin itself.
Step 4: Connect Speech Input to Your App’s Logic
This is where your voice assistant actually becomes useful. Once you have recognized text, decide what happens next. A few common patterns:
- Command matching: check the recognized text against a list of known commands, like “open settings” or “search for [item]”
- Search input: feed the text directly into your app’s existing search function
- AI-powered responses: send the text to a language model API and speak back the response
For anything beyond simple fixed commands, sending the recognized text to an LLM API and reading the reply out loud with flutter_tts is usually the fastest way to build something that feels like a real assistant, rather than a basic command list.
Step 5: Handle Errors and Edge Cases
Voice features fail in ways that text input does not. Plan for these from the start:
- No microphone permission: show a clear message and a way to open device settings, rather than failing silently
- Background noise or unclear speech: display the recognized text before acting on it, so the user can catch a mistake
- No internet connection: some speech recognition depends on network availability, so check connectivity if you rely on it
- Recognition service unavailable: speech services are network-based and can be temporarily throttled, so build in a retry option rather than treating every failure as final<cite index=”52-1″>.</cite>
Step 6: Test on Real Devices
Emulators are not reliable for testing microphone input and speech recognition accuracy. Test on actual Android and iOS devices, across different accents if your user base is diverse, which matters a lot for apps built for Indian users speaking English with regional variation. Pay attention to how the app behaves with background noise, since that is where most real-world voice recognition problems show up.
Common Mistakes to Avoid
- Assuming speech recognition works offline. Some platforms handle it on-device, others send audio to a server. Don’t assume privacy or offline support without checking.
- Skipping the permission request flow. A blank or crashing microphone button is one of the most common bugs in early voice feature builds.
- Ignoring partial results. Users expect to see something happening as they speak, not a blank screen until they stop talking.
- Building for continuous dictation with the wrong tool. If your use case is long-form dictation rather than short commands, check whether your chosen package actually supports that before building around it.
Where This Fits for Startups and Enterprises
Startups usually start with basic voice commands, like search or navigation shortcuts, since these are quick to build and test with real users. Enterprises tend to use voice features for hands-free scenarios, such as field technicians logging data verbally while their hands are occupied, or warehouse staff searching inventory without touching a screen. Both cases use the same underlying packages. The difference is mostly in how much logic sits behind the recognized text.
How FBIP Approaches Voice Features
At FBIP, when a client asks for voice assistants in Flutter apps, we start with the simplest working version: microphone access, speech-to-text, and a clear response, before adding anything more complex like AI-generated replies. This keeps early testing fast and makes it easier to catch permission or device issues before they become bigger problems later in development.
Wrapping Up
Building voice assistants in Flutter apps comes down to a handful of steps: set up permissions correctly, add speech-to-text and text-to-speech packages, connect the recognized text to real logic, and test thoroughly on physical devices. None of this requires deep machine learning knowledge. It just requires putting the right pieces together carefully and testing for the edge cases that voice input brings with it.
FAQs
1. Which Flutter package is best for adding voice recognition to an app?
speech_to_text is the most widely used option for converting speech into text in Flutter apps. It works across Android, iOS, macOS, and web, and it uses the device’s built-in speech recognition engine.
2. Do I need an API key to add voice features to a Flutter app?
Not for basic speech-to-text and text-to-speech using device-based packages like speech_to_text and flutter_tts. You only need an API key if you connect the voice input to a separate service, like an AI language model.
3. Can a Flutter voice assistant work offline?
It depends on the platform and package. Some devices process speech on-device, while others rely on a network connection. Test your specific setup on real devices rather than assuming offline support.
4. Why does speech recognition stop working after a short pause?
On Android, the operating system enforces its own short pause timeout for speech recognition, and this cannot be changed by the app. This is a system-level limitation, not a bug in your code.
5. Is voice input reliable for regional languages like Hindi in Flutter apps?
It depends on what languages are installed on the user’s device, since recognition quality comes from the operating system, not the Flutter plugin. Test language support directly on target devices before assuming full coverage.





