Answer.fromJson constructor

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

Read this payload from a decoded JSON object.

Implementation

factory Answer.fromJson(Map<String, dynamic> json) => Answer(
      question: json['question'] as String,
      choice: json['choice'] == null
          ? null
          : (json['choice'] as List<dynamic>)
              .map((e) => e as String)
              .toList(),
      ranking: json['ranking'] == null
          ? null
          : (json['ranking'] as List<dynamic>)
              .map((e) => e as String)
              .toList(),
      scores: json['scores'] == null
          ? null
          : (json['scores'] as Map<String, dynamic>)
              .map((k, v) => MapEntry(k, v as int)),
      text: json['text'] as String?,
      abstain: json['abstain'],
    );