addMessage method

void addMessage(
  1. NearbyMessage message
)

Adds message to received messages list

Implementation

void addMessage(NearbyMessage message) {
  if (!isEndpointOnly) {
    if (verifier != null) {
      try {
        message.validateAuthenticity(verifier!);
      } catch (e) {
        logger.e("Error validating message authenticity: $e");
      }
    }

    if (!message.isAuthenticated) {
      logger.e("Received message is not from an authenticated third-paty!");
    } else {
      logger.d("Received message is authenticated!");
    }

    messages.add(message);

    _executeCallback(callbackReceivedMessage, this);
    hasNewMessages = true;
  }
}