https://github.com/rxlabz/speech_recognition
A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)
https://github.com/rxlabz/speech_recognition
android flutter ios javascript plugin speech-recognition swift
Last synced: 13 days ago
JSON representation
A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)
- Host: GitHub
- URL: https://github.com/rxlabz/speech_recognition
- Owner: rxlabz
- License: other
- Archived: true
- Created: 2017-06-11T21:56:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-15T10:14:13.000Z (about 3 years ago)
- Last Synced: 2025-02-13T00:00:40.722Z (9 months ago)
- Topics: android, flutter, ios, javascript, plugin, speech-recognition, swift
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/speech_recognition
- Size: 10.3 MB
- Stars: 336
- Watchers: 13
- Forks: 197
- Open Issues: 77
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flutter-cn - Speech Recognition - 语音转文本,由 [Erick Ghaumez](https://twitter.com/rxlabz) 制作。 (组件 / 媒体)
- awesome-flutter-cn - Speech Recognition - 语音识别,[Erick Ghaumez](https://twitter.com/rxlabz). (组件 / 媒体)
- awesome-flutter - Speech Recognition - Speech to text by [Erick Ghaumez](https://twitter.com/rxlabz). (Components / Media)
- awesome-flutter - Speech Recognition - 语音转文字的实用工具,作者:[Erick Ghaumez](https://twitter.com/rxlabz) (Uncategorized / Uncategorized)
- awesome-flutter - Speech Recognition - A Flutter plugin to use speech recognition on iOS & Android (Swift/Java) ` 📝 2 years ago` (Media [🔝](#readme))
- fucking-awesome-flutter - Speech Recognition - Speech to text by 🌎 [Erick Ghaumez](twitter.com/rxlabz). (Components / Media)
- awesome-flutter - Speech Recognition - Speech to text by [Erick Ghaumez](https://twitter.com/rxlabz). (Components / Media)
README
# :warning: Deprecated
___
# speech_recognition
A flutter plugin to use the speech recognition iOS10+ / Android 4.1+
- [Basic Example](https://github.com/rxlabz/speech_recognition/tree/master/example)
- [Sytody, speech to todo app](https://github.com/rxlabz/sytody)

## [Installation](https://pub.dartlang.org/packages/speech_recognition#pub-pkg-tab-installing)
1. Depend on it
Add this to your package's pubspec.yaml file:
```yaml
dependencies:
speech_recognition: "^0.3.0"
```
2. Install it
You can install packages from the command line:
```
$ flutter packages get
```
3. Import it
Now in your Dart code, you can use:
```dart
import 'package:speech_recognition/speech_recognition.dart';
```
## Usage
```dart
//..
_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();
```
### Recognition
- iOS : [Speech API](https://developer.apple.com/reference/speech)
- Android : [SpeechRecognizer](https://developer.android.com/reference/android/speech/SpeechRecognizer.html)
## Permissions
### iOS
#### :warning: iOS : Swift 4.2 project
infos.plist, add :
- Privacy - Microphone Usage Description
- Privacy - Speech Recognition Usage Description
```xml
NSMicrophoneUsageDescription
This application needs to access your microphone
NSSpeechRecognitionUsageDescription
This application needs the speech recognition permission
```
### Android
```xml
```
## Limitation
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](http://flutter.io/).
For help on editing plugin code, view the [documentation](https://flutter.io/platform-plugins/#edit-code).