dispose method

Future<void> dispose()

Implementation

Future<void> dispose() async {
  try {
    if (_isMicOn) {
      await stopListening();
    }
    _azureSpeechRecognition?.recognitionStoppedHandler;
    _azureSpeechRecognition = null;
    _isInitialized = false;
    _recognizedText = '';
    _intermediateResult = '';
  } catch (e) {
    print('Error disposing speech recognition service: $e');
  }
}