handleMethod method

Future handleMethod(
  1. MethodCall call
)

Implementation

Future<dynamic> handleMethod(MethodCall call) async {
  switch (call.method) {
    case "onPostMessage":
      if (_replyProxy == null) {
        _replyProxy = new JavaScriptReplyProxy(this);
      }
      if (onPostMessage != null) {
        String? message = call.arguments["message"];
        Uri? sourceOrigin = call.arguments["sourceOrigin"] != null
            ? Uri.tryParse(call.arguments["sourceOrigin"])
            : null;
        bool isMainFrame = call.arguments["isMainFrame"];
        onPostMessage!(message, sourceOrigin, isMainFrame, _replyProxy!);
      }
      break;
    default:
      throw UnimplementedError("Unimplemented ${call.method} method");
  }
  return null;
}