Poll class
This object contains information about a poll.
Constructors
-
Poll({required String id, required String question, required List<
PollOption> options, required int totalVoterCount, required bool isClosed, required bool isAnonymous, required PollType type, required bool allowsMultipleAnswers, int? correctOptionId, String? explanation, List<MessageEntity> ? explanationEntities, int? openPeriod, int? closeDate, List<MessageEntity> ? questionEntities}) -
Constructs a Poll object
const
-
Poll.fromJson(Map<
String, dynamic> json) -
Creates a Poll object from JSON object
factory
Properties
- allowsMultipleAnswers → bool
-
True, if the poll allows multiple answers
final
- closeDate → int?
-
Optional. Point in time (Unix timestamp) when the poll will be automatically closed
final
- closeDateTime → DateTime?
-
The DateTime object for closeDate
no setter
- 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.
final
- 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
final
-
explanationEntities
→ List<
MessageEntity> ? -
Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique poll identifier
final
- isAnonymous → bool
-
True, if the poll is anonymous
final
- isClosed → bool
-
True, if the poll is closed
final
- openPeriod → int?
-
Optional. Amount of time in seconds the poll will be active after creation
final
- openPeriodDuration → Duration?
-
The Duration object for openPeriod
no setter
-
options
→ List<
PollOption> -
List of poll options
final
- question → String
-
Poll question, 1-300 characters
final
-
questionEntities
→ List<
MessageEntity> ? -
Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalVoterCount → int
-
Total number of users that voted in the poll
final
- type → PollType
-
Poll type, currently can be “regular” or “quiz”
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts a Poll object to a JSON object
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited