CachedContent.fromJson constructor

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

Implementation

factory CachedContent.fromJson(Map<String, dynamic> json) {
  return CachedContent(
    expireTime: decodeCustom(json['expireTime'], Timestamp.fromJson),
    ttl: decodeCustom(json['ttl'], Duration.fromJson),
    name: json['name'],
    displayName: json['displayName'],
    model: json['model'],
    systemInstruction: decode(json['systemInstruction'], Content.fromJson),
    contents: decodeListMessage(json['contents'], Content.fromJson) ?? [],
    tools: decodeListMessage(json['tools'], Tool.fromJson) ?? [],
    toolConfig: decode(json['toolConfig'], ToolConfig.fromJson),
    createTime: decodeCustom(json['createTime'], Timestamp.fromJson),
    updateTime: decodeCustom(json['updateTime'], Timestamp.fromJson),
    usageMetadata: decode(
      json['usageMetadata'],
      CachedContent_UsageMetadata.fromJson,
    ),
  );
}