Poll class final

Describes a poll

Inheritance
Available extensions
Annotations
  • @immutable

Constructors

Poll({required int id, FormattedText? question, required List<PollOption> options, required int totalVoterCount, required List<MessageSender> recentVoterIds, required bool canGetVoters, required bool canSeeResults, required bool isAnonymous, required bool allowsMultipleAnswers, required bool allowsRevoting, required bool membersOnly, required List<String> countryCodes, required List<int> optionOrder, PollType? type, required int openPeriod, required int closeDate, required bool isClosed, PollVoteRestrictionReason? voteRestrictionReason})

Properties

allowsMultipleAnswers bool
allowsMultipleAnswers True, if multiple answer options can be chosen simultaneously
final
allowsRevoting bool
allowsRevoting True, if the poll can be answered multiple times
final
canGetVoters bool
canGetVoters True, if the current user can get voters in the poll using getPollVoters
final
canSeeResults bool
canSeeResults True, if the current user can see results of the poll
final
closeDate int
closeDate Point in time (Unix timestamp) when the poll will automatically be closed
final
countryCodes List<String>
countryCodes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be able to vote. If empty, then all users can participate in the poll
final
hashCode int
The hash code for this object.
no setteroverride
id int
id Unique poll identifier
final
isAnonymous bool
isAnonymous True, if the poll is anonymous
final
isClosed bool
isClosed True, if the poll is closed
final
membersOnly bool
membersOnly True, if only the users that are members of the chat for more than a day will be able to vote
final
openPeriod int
openPeriod Amount of time the poll will be active after creation, in seconds
final
optionOrder List<int>
optionOrder The list of 0-based poll identifiers in which the options of the poll must be shown; empty if the order of options must not be changed
final
options List<PollOption>
options List of poll answer options
final
question FormattedText?
question Poll question; 1-300 characters; may contain only custom emoji entities
final
recentVoterIds List<MessageSender>
recentVoterIds Identifiers of recent voters, if the poll is non-anonymous and poll results are available
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalVoterCount int
totalVoterCount Total number of voters, participating in the poll
final
type PollType?
type Type of the poll
final
voteRestrictionReason PollVoteRestrictionReason?
voteRestrictionReason The reason describing, why the current user can't vote in the poll; may be null if the user can vote in the poll
final

Methods

copyWith({int? id, FormattedText? question, List<PollOption>? options, int? totalVoterCount, List<MessageSender>? recentVoterIds, bool? canGetVoters, bool? canSeeResults, bool? isAnonymous, bool? allowsMultipleAnswers, bool? allowsRevoting, bool? membersOnly, List<String>? countryCodes, List<int>? optionOrder, PollType? type, int? openPeriod, int? closeDate, bool? isClosed, PollVoteRestrictionReason? voteRestrictionReason}) Poll

Available on Poll, provided by the PollExtensions extension

getConstructor() String
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJson(Map<String, dynamic>? json) Poll?

Constants

constructor → const String