fromJson static method

Poll fromJson(
  1. Map<String, dynamic> json
)

Creates a object from a json

Implementation

static Poll fromJson(Map<String, dynamic> json) {
  return Poll(
    id: json['id']!,
    question: json['question']!,
    options: PollOption.listFromJsonArray(json['options']!),
    totalVoterCount: json['total_voter_count']!,
    isClosed: json['is_closed']!,
    isAnonymous: json['is_anonymous']!,
    type: PollType.forValue(json['type']),
    allowsMultipleAnswers: json['allows_multiple_answers']!,
    correctOptionId: json['correct_option_id'],
    explanation: json['explanation'],
    explanationEntities: callIfNotNull(
      MessageEntity.listFromJsonArray,
      json['explanation_entities'],
    ),
    openPeriod: json['open_period'],
    closeDate: json['close_date'],
  );
}