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
-
- @JsonSerializable()
Constructors
-
Poll.new({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.
getter/setter pair
- allowUserSuggestion ↔ bool
-
True if this poll allows user suggestion, false otherwise.
getter/setter pair
- 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
.getter/setter pair - 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.getter/setter pair - data ↔ PollData?
-
An additional json data to accompany the poll.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → int
-
A unique identifier for this poll.
final
- messageId ↔ int?
-
A id of the message that contains this poll
getter/setter pair
-
options
↔ List<
PollOption> -
Options for this poll.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status ↔ PollStatus
-
Indicates whether this poll is PollStatus.open, or PollStatus.closed
getter/setter pair
- title ↔ String
-
Title of the poll.
getter/setter pair
- updatedAt ↔ int
-
Unix timestamp at which the poll is updated (ms).
getter/setter pair
-
votedPollOptionIds
↔ List<
int> ? -
Contains optionIds which the current user voted on.
If the current user has not voted, this list will be empty.
getter/setter pair
- voterCount ↔ int
-
Total voter count.
getter/setter pair
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.