NlpResult.fromJson constructor

NlpResult.fromJson(
  1. Map json
)

Implementation

factory NlpResult.fromJson(Map json) {
  final List<Map>? moreResultsJson = json['moreResults']?.cast<Map>();
  final List<NlpResult>? moreResults =
      moreResultsJson?.map<NlpResult>(NlpResult.fromJson).toList();

  final AiuiData? data =
      json['data'] == null ? null : AiuiData.fromJson(json['data']);
  final Answer? answer =
      json['answer'] == null ? null : Answer.fromJson(json['answer']);

  final List<Map>? semanticJson = json['semantic']?.cast<Map>();
  final List<Semantic>? semantic =
      semanticJson?.map<Semantic>(Semantic.fromJson).toList();
  return NlpResult(
    rc: Rc.parse(json['rc']),
    error: json['error'],
    text: json['text'],
    vendor: json['vendor'],
    service: json['service'],
    semantic: json['semantic'] == null ? null : semantic,
    data: data,
    answer: answer,
    category: json['category'],
    dialogStat: json['dialog_stat'],
    moreResults: moreResults,
    shouldEndSession: json['shouldEndSession'] == 'true',
    uuid: json['uuid'],
    version: json['version'],
    usedState: json['used_state'],
    state: json['state'],
    sid: json['sid'],
    saveHistory: json['save_history'],
  );
}