/ Audio

A Flutter plugin to use speech recognition on iOS & Android

A Flutter plugin to use speech recognition on iOS & Android


A flutter plugin to use the speech recognition iOS10+ / Android 4.1+


  1. Depend on it
    Add this to your package's pubspec.yaml file:
  speech_recognition: "^0.2.0+1"
  1. Install it
    You can install packages from the command line:
$ flutter packages get

Alternatively, your editor might support 'packages get'. Check the docs for your editor to learn more.

  1. Import it
    Now in your Dart code, you can use:
import 'package:speech_recognition/speech_recognition.dart';


_speech = new SpeechRecognition();

// The flutter app not only call methods on the host platform,
// it also needs to receive method calls from host.
_speech.setAvailabilityHandler((bool result) 
  => setState(() => _speechRecognitionAvailable = result));

// handle device current locale detection
_speech.setCurrentLocaleHandler((String locale) =>
 setState(() => _currentLocale = locale));

  => setState(() => _isListening = true));

// this handler will be called during recognition. 
// the iOS API sends intermediate results,
// On my Android device, only the final transcription is received
_speech.setRecognitionResultHandler((String text) 
  => setState(() => transcription = text));

  => setState(() => _isListening = false));

// 1st launch : speech recognition permission / initialization
    .then((res) => setState(() => _speechRecognitionAvailable = res));

speech.listen(locale:_currentLocale).then((result)=> print('result : $result'));

// ...


// ||





infos.plist, add :

  • Privacy - Microphone Usage Description
  • Privacy - Speech Recognition Usage Description
<string>This application needs to access your microphone</string>
<string>This application needs the speech recognition permission</string>

:warning: Swift project

This plugin is written in swift, so to use with in a Flutter/ObjC project,
you need to convert the project to "Current swift syntax" ( Edit/Convert/current swift syntax)


<uses-permission android:name="android.permission.RECORD_AUDIO" />


On iOS, by default the plugin is configured for French, English, Russian, Spanish.
On Android, without additional installations, it will probably works only with the default device locale.