fromJson static method
Implementation
static PollOption? fromJson(Map<String, dynamic>? json) {
if (json == null) {
return null;
}
return PollOption(
id: (json['id'] as String?) ?? '',
text: FormattedText.fromJson(tdMapFromJson(json['text'])),
media: PollMedia.fromJson(tdMapFromJson(json['media'])),
voterCount: (json['voter_count'] as int?) ?? 0,
votePercentage: (json['vote_percentage'] as int?) ?? 0,
recentVoterIds: List<MessageSender>.from(
tdListFromJson(json['recent_voter_ids'])
.map((item) => MessageSender.fromJson(tdMapFromJson(item)))
.whereType<MessageSender>(),
),
isChosen: (json['is_chosen'] as bool?) ?? false,
isBeingChosen: (json['is_being_chosen'] as bool?) ?? false,
author: MessageSender.fromJson(tdMapFromJson(json['author'])),
additionDate: (json['addition_date'] as int?) ?? 0,
);
}