initSpeechService method
Init a speech service that will use the provided recognizer to process
audio input from the device microphone.
This method may throw MicrophoneAccessDeniedException.
Implementation
Future<SpeechService> initSpeechService(final Recognizer recognizer) async {
if (!await PermissionService.requestMicrophonePermission()) {
throw MicrophoneAccessDeniedException();
}
await _channel.invokeMethod('speechService.init', {
'recognizerId': recognizer.id,
'sampleRate': recognizer.sampleRate,
});
return SpeechService(_channel);
}