GeminiAIHttpResponse.fromJson constructor

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

Implementation

factory GeminiAIHttpResponse.fromJson(Map<String, dynamic> json) {
  List<GeminiAIResponseTransporter> responseCandidates = [];
  for (var candidate in json['candidates']) {
    responseCandidates.add(
      GeminiAIResponseTransporter.fromJson(candidate),
    );
  }
  return GeminiAIHttpResponse(
    candidates: responseCandidates,
    promptFeedback: json['promptFeedback'],
  );
}