You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 15, 2022. It is now read-only.
//..
_speech =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));
_speech.setRecognitionStartedHandler(()
=>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));
_speech.setRecognitionCompleteHandler(()
=>setState(() => _isListening =false));
// 1st launch : speech recognition permission / initialization
_speech
.activate()
.then((res) =>setState(() => _speechRecognitionAvailable = res));
//..
speech.listen(locale:_currentLocale).then((result)=>print('result : $result'));
// ...
speech.cancel();
// ||
speech.stop();
On iOS, by default the plugin is configured for French, English, Russian, Spanish, Italian.
On Android, without additional installations, it will probably works only with the default device locale.
Troubleshooting
If you get a MissingPluginException, try to flutter build apk on Android, or flutter build ios
Getting Started
For help getting started with Flutter, view our online
documentation.
For help on editing plugin code, view the documentation.
About
A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)