handleMethodCall method
Implementation
Future<dynamic> handleMethodCall(MethodCall call) async {
switch (call.method) {
case 'speak':
return _handleSpeak(call);
case 'stop':
_stop();
return 1;
case 'pause':
_pause();
return 1;
case 'setVolume':
_volume = (call.arguments as num).toDouble();
return 1;
case 'setSpeechRate':
_rate = (call.arguments as num).toDouble();
return 1;
case 'setPitch':
_pitch = (call.arguments as num).toDouble();
return 1;
case 'setLanguage':
_language = call.arguments as String;
_updateSelectedVoiceFromLang();
return 1;
case 'setVoice':
_setVoice(call.arguments as Map<dynamic, dynamic>);
return 1;
case 'getVoices':
return _getVoices();
case 'getLanguages':
return _getLanguages();
case 'awaitSpeakCompletion':
_awaitSpeakCompletion = call.arguments as bool;
return 1;
case 'isLanguageAvailable':
return _isLanguageAvailable(call.arguments as String);
case 'detectLanguage':
return _detectLanguage(call.arguments as String);
default:
throw PlatformException(
code: 'Unimplemented',
details: "text_to_speech_plus web: method '${call.method}' not implemented",
);
}
}