v2.0.1
flutter_speech
Android, iOS 및 Mac OSX에서 음성 인식을 지원하는 Flutter 플러그인
54좋아요 23930일 다운로드140Pub 점수
AndroidiOSmacOS
jaumard/flutter_speech_recognition open-source repository details.
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Based on rxlabz plugin
Objective C and Java Flutter plugin.
A flutter plugin to use the speech recognition iOS10+ / Android 4.1+ and MacOS 10.15+
Add this on your Info.plist
<key>NSMicrophoneUsageDescription</key>
<string>This application needs to access your microphone</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This application needs the speech recognition permission</string>
Nothing to do :)
//..
_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();