platformCallHandler method

Future platformCallHandler(
  1. MethodCall call
)

Platform listeners

Implementation

Future<dynamic> platformCallHandler(MethodCall call) async {
  switch (call.method) {
    case "speak.onStart":
      if (startHandler != null) {
        startHandler!();
      }
      break;

    case "synth.onStart":
      if (startHandler != null) {
        startHandler!();
      }
      break;
    case "speak.onComplete":
      if (completionHandler != null) {
        completionHandler!();
      }
      break;
    case "synth.onComplete":
      if (completionHandler != null) {
        completionHandler!();
      }
      break;
    case "speak.onPause":
      if (pauseHandler != null) {
        pauseHandler!();
      }
      break;
    case "speak.onContinue":
      if (continueHandler != null) {
        continueHandler!();
      }
      break;
    case "speak.onCancel":
      if (cancelHandler != null) {
        cancelHandler!();
      }
      break;
    case "speak.onError":
      if (errorHandler != null) {
        errorHandler!(call.arguments);
      }
      break;
    case 'speak.onProgress':
      if (progressHandler != null) {
        final args = call.arguments as Map<dynamic, dynamic>;
        progressHandler!(
          args['text'].toString(),
          int.parse(args['start'].toString()),
          int.parse(args['end'].toString()),
          args['word'].toString(),
        );
      }
      break;
    case "synth.onError":
      if (errorHandler != null) {
        errorHandler!(call.arguments);
      }
      break;
    default:
      print('Unknowm method ${call.method}');
  }
}