title: How to handle _platformCallHandler call speech.onError 7?
body: <p>I am trying to implement the speech_recognition plugin in the flutter. And the recognition works perfectly when I speak and the app runs smoothly. but when I click on the mic button and speak nothing it shows the following error and then the functionality of the mic button stops until i restart the app.</p>
  
  <pre><code>D/SpeechRecognitionPlugin( 1155): onError : 7
  I/flutter ( 1155): _platformCallHandler call speech.onSpeechAvailability false
  I/flutter ( 1155): _platformCallHandler call speech.onError 7
  I/flutter ( 1155): Unknowm method speech.onError 
  </code></pre>
  
  <p>Can anyone please help me with this issue</p>
  
  <p>this is my speech_recognition.dart file</p>
  
  <pre><code>import 'dart:async';
  
  import 'dart:ui';
  import 'package:flutter/services.dart';
  
  typedef void AvailabilityHandler(bool result);
  typedef void StringResultHandler(String text);
  
  /// the channel to control the speech recognition
  class SpeechRecognition {
    static const MethodChannel _channel =
        const MethodChannel('speech_recognition');
  
    static final SpeechRecognition _speech = new SpeechRecognition._internal();
  
    factory SpeechRecognition() =&gt; _speech;
  
    SpeechRecognition._internal() {
      _channel.setMethodCallHandler(_platformCallHandler);
    }
  
    AvailabilityHandler availabilityHandler;
  
    StringResultHandler currentLocaleHandler;
    StringResultHandler recognitionResultHandler;
  
    VoidCallback recognitionStartedHandler;
  
    VoidCallback recognitionCompleteHandler;
    VoidCallback errorHandler;
  
    /// ask for speech  recognizer permission
    Future activate() =&gt; _channel.invokeMethod("speech.activate");
  
    /// start listening
    Future listen({String locale}) =&gt;
        _channel.invokeMethod("speech.listen", locale);
  
    Future cancel() =&gt; _channel.invokeMethod("speech.cancel");
  
    Future stop() =&gt; _channel.invokeMethod("speech.stop");
  
    Future _platformCallHandler(MethodCall call) async {
      print("_platformCallHandler call ${call.method} ${call.arguments}");
      switch (call.method) {
        case "speech.onSpeechAvailability":
          availabilityHandler(call.arguments);
          break;
        case "speech.onCurrentLocale":
          currentLocaleHandler(call.arguments);
          break;
        case "speech.onSpeech":
          recognitionResultHandler(call.arguments);
          break;
        case "speech.onRecognitionStarted":
          recognitionStartedHandler();
          break;
        case "speech.onRecognitionComplete":
          recognitionCompleteHandler();
          break;
        case "speech.onError":
          errorHandler();
          break;
        default:
          print('Unknowm method ${call.method} ');
      }
    }
  
    // define a method to handle availability / permission result
    void setAvailabilityHandler(AvailabilityHandler handler) =&gt;
        availabilityHandler = handler;
  
    // define a method to handle recognition result
    void setRecognitionResultHandler(StringResultHandler handler) =&gt;
        recognitionResultHandler = handler;
  
    // define a method to handle native call
    void setRecognitionStartedHandler(VoidCallback handler) =&gt;
        recognitionStartedHandler = handler;
  
    // define a method to handle native call
    void setRecognitionCompleteHandler(VoidCallback handler) =&gt;
        recognitionCompleteHandler = handler;
  
    void setCurrentLocaleHandler(StringResultHandler handler) =&gt;
        currentLocaleHandler = handler;
  
    void setErrorHandler(VoidCallback handler) =&gt; errorHandler = handler;
  
  }
  </code></pre>