toJson method

Map<String, dynamic> toJson()

Serialize to a JSON-encodable map, omitting absent members.

Implementation

Map<String, dynamic> toJson() => <String, dynamic>{
      'question': question,
      'abstained': abstained,
      if (choice != null) 'choice': choice!,
      if (ranking != null) 'ranking': ranking!,
      if (score != null)
        'score': score!.map((k, v) => MapEntry(k, v.toJson())),
      if (text != null) 'text': text!,
      if (withheld != null) 'withheld': withheld!,
    };