addMessageFromDevice method

Device? addMessageFromDevice(
  1. String endpointId,
  2. NearbyMessage message
)

Adds message received to the device where it comes from.

Implementation

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

  device.addMessage(message);
  return device;
}