CachedContent.fromJson constructor
CachedContent.fromJson(
- Object? j
Implementation
factory CachedContent.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return CachedContent(
expireTime: switch (json['expireTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
ttl: switch (json['ttl']) {
null => null,
Object $1 => Duration.fromJson($1),
},
name: switch (json['name']) {
null => null,
Object $1 => decodeString($1),
},
displayName: switch (json['displayName']) {
null => null,
Object $1 => decodeString($1),
},
model: switch (json['model']) {
null => null,
Object $1 => decodeString($1),
},
systemInstruction: switch (json['systemInstruction']) {
null => null,
Object $1 => Content.fromJson($1),
},
contents: switch (json['contents']) {
null => [],
List<Object?> $1 => [for (final i in $1) Content.fromJson(i)],
_ => throw const FormatException('"contents" is not a list'),
},
tools: switch (json['tools']) {
null => [],
List<Object?> $1 => [for (final i in $1) Tool.fromJson(i)],
_ => throw const FormatException('"tools" is not a list'),
},
toolConfig: switch (json['toolConfig']) {
null => null,
Object $1 => ToolConfig.fromJson($1),
},
createTime: switch (json['createTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
updateTime: switch (json['updateTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
usageMetadata: switch (json['usageMetadata']) {
null => null,
Object $1 => CachedContent_UsageMetadata.fromJson($1),
},
);
}