GenerateTextResponse.fromJson constructor
GenerateTextResponse.fromJson(
- Object? j
Implementation
factory GenerateTextResponse.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return GenerateTextResponse(
candidates: switch (json['candidates']) {
null => [],
List<Object?> $1 => [for (final i in $1) TextCompletion.fromJson(i)],
_ => throw const FormatException('"candidates" is not a list'),
},
filters: switch (json['filters']) {
null => [],
List<Object?> $1 => [for (final i in $1) ContentFilter.fromJson(i)],
_ => throw const FormatException('"filters" is not a list'),
},
safetyFeedback: switch (json['safetyFeedback']) {
null => [],
List<Object?> $1 => [for (final i in $1) SafetyFeedback.fromJson(i)],
_ => throw const FormatException('"safetyFeedback" is not a list'),
},
);
}