speech_recognition
speech_recognition copied to clipboard
The method 'setErrorHandler' isn't defined for the class 'SpeechRecognition'.
Hi, I'm using the latest available package:
speech_recognition: ^0.3.0+1
the flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.31.1)
[!] Proxy Configuration
! NO_PROXY does not contain 127.0.0.1
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
trying to check the basic example app:
void activateSpeechRecognizer() {
print('_MyAppState.activateSpeechRecognizer... ');
_speech = new SpeechRecognition();
_speech.setAvailabilityHandler(onSpeechAvailability);
_speech.setCurrentLocaleHandler(onCurrentLocale);
_speech.setRecognitionStartedHandler(onRecognitionStarted);
_speech.setRecognitionResultHandler(onRecognitionResult);
_speech.setRecognitionCompleteHandler(onRecognitionComplete);
_speech.setErrorHandler(errorHandler);
_speech
.activate()
.then((res) => setState(() => _speechRecognitionAvailable = res));
}
and getting this message:
The method 'setErrorHandler' isn't defined for the class 'SpeechRecognition'.
also some suspicious error from my previous run (flutter run output):
I/flutter (19599): Unknowm method speech.onError
I have the same issue, and I have another issue is 'speech_recognition/speech_recognition-Swift.h' file not found. I don't know why?
the source in pub.dev is different from the source in here., i copied the main.dart here and it works.
Can you please post the fix you got here? Unable to find the pub.dev
My (not so clean) workaround was to separate speech_recognition.dart
into my own project structure and remove setErrorHandler
method from it. It's working for me.
Here is the patch file in .txt format:
error_handler_patch.txt