Poll class

Class representing a poll. A poll instance can be created using Poll.create with PollCreateParams and updated using GroupChannelPoll.updatePoll with PollUpdateParams class. A poll can be attached to a message using UserMessageCreateParams.pollId.

Annotations

Constructors

Poll({required int id, required String title, required int createdAt, required int updatedAt, required int closeAt, required PollStatus status, int? messageId, PollData? data, int voterCount = -1, List<PollOption> options = const [], String? createdBy, bool allowUserSuggestion = false, bool allowMultipleVotes = false, List<int>? votedPollOptionIds})
Poll.fromJson(Map<String, dynamic> json)
factory

Properties

allowMultipleVotes bool
True if this poll allows multiple votes, false otherwise.
read / write
allowUserSuggestion bool
True if this poll allows user suggestion, false otherwise.
read / write
closeAt int
Unix timestamp at which the poll has closed or will close. (second precision) If poll closing time is not specified, this value will be -1.
read / write
createdAt int
Unix timestamp at which the poll is created (ms).
final
createdBy String?
UserId of the poll creator. null if the creator account is removed.
final
data PollData?
An additional json data to accompany the poll.
read / write
hashCode int
The hash code for this object.
read-onlyoverride
id int
A unique identifier for this poll.
final
messageId int?
A id of the message that contains this poll
final
options List<PollOption>
Options for this poll.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
status PollStatus
Indicates whether this poll is PollStatus.open, or PollStatus.closed
read / write
title String
Title of the poll.
read / write
updatedAt int
Unix timestamp at which the poll is updated (ms).
read / write
votedPollOptionIds List<int>?
Contains optionIds which the current user voted on. If the current user has not voted, this list will be empty.
read / write
voterCount int
Total voter count.
read / write

Methods

applyPollUpdateEvent(PollUpdateEvent event) bool
Applies poll update event to this user message's poll.
applyPollVoteEvent(PollVoteEvent event) bool
Applies poll vote event to this user message's poll.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

create(PollCreateParams params, {Chat? chat}) Future<Poll>
Builds Poll instance with given params instance.
get(PollRetrievalParams params, {Chat? chat}) Future<Poll>
Retrieves latest poll matching PollRetrievalParams.pollId instance from server.