ChatGPTAnswerResponseModel.fromJson constructor

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

Implementation

factory ChatGPTAnswerResponseModel.fromJson(Map<String, dynamic> json) =>
    ChatGPTAnswerResponseModel(
      id: json["id"] ?? "",
      object: json["object"] ?? "",
      created: json["created"] ?? 0,
      model: json["model"] ?? "",
      choices: json["choices"] != null
          ? List<ChatGPTChoiceModel>.from(
              json["choices"].map((x) => ChatGPTChoiceModel.fromJson(x)),
            )
          : [],
      usage: json["usage"] != null
          ? ChatGPTUsageModel.fromJson(json["usage"])
          : ChatGPTUsageModel(),
      error: json['error'] is Map
          ? ChatGPTErrorModel.fromJson(json['error'])
          : ChatGPTErrorModel(),
    );