Skip to content

Commit

Permalink
fix: speech and network timeout identical
Browse files Browse the repository at this point in the history
The error strings for two different cases,
network_timeout and speech_timeout where the
same so they couldn't be differentiated. This fixes that
and documents the error strings.
sowens-csd committed Mar 10, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 914bc61 commit 3ac3046
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -332,11 +332,11 @@ class SpeechToTextPlugin(activity: Activity, channel: MethodChannel) :
SpeechRecognizer.ERROR_CLIENT -> "error_client"
SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS -> "error_permission"
SpeechRecognizer.ERROR_NETWORK -> "error_network"
SpeechRecognizer.ERROR_NETWORK_TIMEOUT -> "error_timeout"
SpeechRecognizer.ERROR_NETWORK_TIMEOUT -> "error_network_timeout"
SpeechRecognizer.ERROR_NO_MATCH -> "error_no_match"
SpeechRecognizer.ERROR_RECOGNIZER_BUSY -> "error_busy"
SpeechRecognizer.ERROR_SERVER -> "error_server"
SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "error_timeout"
SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "error_speech_timeout"
else -> "error_unknown"
}
sendError(errorMsg)
11 changes: 11 additions & 0 deletions lib/speech_to_text.dart
Original file line number Diff line number Diff line change
@@ -13,6 +13,17 @@ typedef SpeechResultListener = void Function(SpeechRecognitionResult result);

/// Notified if errors occur during recognition or intialization.
///
/// Possible errors per the Android docs are described here:
/// https://developer.android.com/reference/android/speech/SpeechRecognizer
/// "error_audio_error"
/// "error_client"
/// "error_permission"
/// "error_network"
/// "error_network_timeout"
/// "error_no_match"
/// "error_busy"
/// "error_server"
/// "error_speech_timeout"
/// See the [onError] argument on the [initialize] method for use.
typedef SpeechErrorListener = void Function(
SpeechRecognitionError errorNotification);

0 comments on commit 3ac3046

Please sign in to comment.