Poll.fromJson constructor
Parse from a json
Implementation
factory Poll.fromJson(Map<String, dynamic> json) => Poll(
id: int.parse(json['id']),
question: json['question'],
options: List<PollOption>.from((json['options'] ?? [])
.map((item) => PollOption.fromJson(item))
.toList()),
totalVoterCount: json['total_voter_count'],
recentVoterIds: List<MessageSender>.from(
(json['recent_voter_ids'] ?? [])
.map((item) => MessageSender.fromJson(item))
.toList()),
isAnonymous: json['is_anonymous'],
type: PollType.fromJson(json['type']),
openPeriod: json['open_period'],
closeDate: json['close_date'],
isClosed: json['is_closed'],
);