QuestionResult.fromJson constructor

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

Read this payload from a decoded JSON object.

Implementation

factory QuestionResult.fromJson(Map<String, dynamic> json) => QuestionResult(
      question: json['question'] as String,
      abstained: json['abstained'] as int,
      choice: json['choice'] == null
          ? null
          : (json['choice'] as Map<String, dynamic>)
              .map((k, v) => MapEntry(k, v as int)),
      ranking: json['ranking'] == null
          ? null
          : (json['ranking'] as Map<String, dynamic>).map((k, v) => MapEntry(
              k, (v as List<dynamic>).map((e) => e as int).toList())),
      score: json['score'] == null
          ? null
          : (json['score'] as Map<String, dynamic>).map((k, v) => MapEntry(k,
              QuestionResultScoreValue.fromJson(v as Map<String, dynamic>))),
      text: json['text'] == null
          ? null
          : (json['text'] as List<dynamic>).map((e) => e as String).toList(),
      withheld: json['withheld'] as bool?,
    );