handleMethod method

Future handleMethod(
  1. MethodCall call
)

Implementation

Future<dynamic> handleMethod(MethodCall call) async {
  switch (call.method) {
    case "onMessage":
      int index = call.arguments["index"];
      var port = index == 0 ? this.port1 : this.port2;
      if (port._onMessage != null) {
        String? message = call.arguments["message"];
        port._onMessage!(message);
      }
      break;
    default:
      throw UnimplementedError("Unimplemented ${call.method} method");
  }
  return null;
}