GenerateMessageResponse.fromJson constructor
GenerateMessageResponse.fromJson(
- Object? j
Implementation
factory GenerateMessageResponse.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return GenerateMessageResponse(
candidates: switch (json['candidates']) {
null => [],
List<Object?> $1 => [for (final i in $1) Message.fromJson(i)],
_ => throw const FormatException('"candidates" is not a list'),
},
messages: switch (json['messages']) {
null => [],
List<Object?> $1 => [for (final i in $1) Message.fromJson(i)],
_ => throw const FormatException('"messages" 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'),
},
);
}