endPoll method

Future<String?> endPoll({
  1. String? txid,
})

Implementation

Future<String?> endPoll({String? txid}) {
  if (type != PollEventContent.startType) {
    throw Exception('Event is not a poll.');
  }
  if (senderId != room.client.userID) {
    throw Exception('You can not end a poll created by someone else.');
  }
  return room.sendEvent(
    {
      'm.relates_to': {
        'rel_type': RelationshipTypes.reference,
        'event_id': eventId,
      },
      PollEventContent.endType: {},
    },
    type: PollEventContent.endType,
    txid: txid,
  );
}