toJson method
Converts a Poll object to a JSON object
Implementation
Map<String, dynamic> toJson() {
return {
'id': id,
'question': question,
'options': options.map((x) => x.toJson()).toList(),
'total_voter_count': totalVoterCount,
'is_closed': isClosed,
'is_anonymous': isAnonymous,
'type': type.toJson(),
'allows_multiple_answers': allowsMultipleAnswers,
'correct_option_id': correctOptionId,
'explanation': explanation,
'explanation_entities':
explanationEntities?.map((x) => x.toJson()).toList(),
'open_period': openPeriod,
'close_date': closeDate,
'question_entities': questionEntities?.map((x) => x.toJson()).toList(),
}..removeWhere(_nullFilter);
}