sendMessageToDevice method

void sendMessageToDevice(
  1. String endpointId,
  2. String message
)

Sends message to a given device given its endpointId

Implementation

void sendMessageToDevice(String endpointId, String message) async {
  Device? device = _findDevice(connectedDevices, endpointId);
  if (device == null) {
    logger.e("Could not find device $endpointId");
    return;
  }

  var nbMessage = NearbyMessage.fromString(message);
  authenticationManager?.sign(nbMessage);
  device.sendMessage(nbMessage);
}