sendPollResponse method

void sendPollResponse(
  1. dynamic senderId
)

Implementation

void sendPollResponse(senderId){
  try {
    // Create optObject with the relevant data
    Map<String, dynamic> optObject = {
      "optionSelected": selectedOptionKey.value,
      "optionSelectedValue": selectedOptionValue.value,
      "name": getClientName,
      "user_ref": userModelSelf?.userRef,
      "clientId": userModelSelf?.clientId,
      "id": pollId,
    };

    // Create the main JSON object
    Map<String, dynamic> jsonObject1 = {
      "type": "poll-response",
      "data": optObject,
    };

    // Create the list of client IDs
    List<String> clientIdList = [senderId];

    // Send the data to the room (enxRoom.sendUserData equivalent)
    EnxRtc.sendUserData(jsonObject1, false, clientIdList);
  } catch (e) {
    print(e);
  }

}