sendMessage method

Future<void> sendMessage(
  1. Map<String, dynamic> message, {
  2. MessageReplyHandler? replyHandler,
})

Send message to companion app, message can only be sent if getReachability is true

Implementation

Future<void> sendMessage(Map<String, dynamic> message,
    {MessageReplyHandler? replyHandler}) {
  String? handlerId;
  if (replyHandler != null) {
    handlerId = getRandomString(20);
    _watchOSObserver.replyHandlers[handlerId] = replyHandler;
  }
  return channel.invokeMethod("sendMessage", {
    "message": message,
    if (handlerId != null) "replyHandlerId": handlerId
  });
}