Poll class abstract

This object contains information about a poll.

Available extensions
Annotations
  • @freezed

Constructors

Poll.new({@JsonKey(name: 'id') required String id, @JsonKey(name: 'question') required String question, @JsonKey(name: 'options') required List<PollOption> options, @JsonKey(name: 'total_voter_count') required int totalVoterCount, @JsonKey(name: 'is_closed') required bool isClosed, @JsonKey(name: 'is_anonymous') required bool isAnonymous, @JsonKey(name: 'type') required PollType type, @JsonKey(name: 'allows_multiple_answers') required bool allowsMultipleAnswers, @JsonKey(name: 'correct_option_id') int? correctOptionId, @JsonKey(name: 'explanation') String? explanation, @JsonKey(name: 'explanation_entities') List<MessageEntity>? explanationEntities, @JsonKey(name: 'open_period') int? openPeriod, @JsonKey(name: 'close_date') int? closeDate, @JsonKey(name: 'question_entities') List<MessageEntity>? questionEntities})
Constructs a Poll object
const
factory
Poll.fromJson(Map<String, dynamic> json)
Creates a Poll object from JSON object
factory

Properties

allowsMultipleAnswers bool
True, if the poll allows multiple answers
no setterinherited
closeDate int?
Optional. Point in time (Unix timestamp) when the poll will be automatically closed
no setterinherited
closeDateTime DateTime?

Available on Poll, provided by the PollExtension extension

The DateTime object for closeDate
no setter
copyWith → $PollCopyWith<Poll>
Create a copy of Poll with the given fields replaced by the non-null parameter values.
no setterinherited
correctOptionId int?
Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
no setterinherited
explanation String?
Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
no setterinherited
explanationEntities List<MessageEntity>?
Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
Unique poll identifier
no setterinherited
isAnonymous bool
True, if the poll is anonymous
no setterinherited
isClosed bool
True, if the poll is closed
no setterinherited
openPeriod int?
Optional. Amount of time in seconds the poll will be active after creation
no setterinherited
openPeriodDuration Duration?

Available on Poll, provided by the PollExtension extension

The Duration object for openPeriod
no setter
options List<PollOption>
List of poll options
no setterinherited
question String
Poll question, 1-300 characters
no setterinherited
questionEntities List<MessageEntity>?
Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalVoterCount int
Total number of users that voted in the poll
no setterinherited
type PollType
Poll type, currently can be "regular" or "quiz"
no setterinherited

Methods

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

Operators

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