toJson method
Creates a json from the object
Implementation
Map toJson() {
return {
'id': id,
'question': question,
'options': options,
'total_voter_count': totalVoterCount,
'is_closed': isClosed,
'is_anonymous': isAnonymous,
'type': type,
'allows_multiple_answers': allowsMultipleAnswers,
'correct_option_id': correctOptionId,
'explanation': explanation,
'explanation_entities': explanationEntities,
'open_period': openPeriod,
'close_date': closeDate,
}..removeWhere((_, v) => v == null);
}