ConversationContent.fromJson constructor
Creates a ConversationContent from JSON.
Implementation
factory ConversationContent.fromJson(Map<String, dynamic> json) {
final type = json['type'] as String;
return switch (type) {
'input_text' => ConversationInputTextContent.fromJson(json),
'input_image' => ConversationInputImageContent.fromJson(json),
'input_file' => ConversationInputFileContent.fromJson(json),
'output_text' => ConversationOutputTextContent.fromJson(json),
'refusal' => ConversationRefusalContent.fromJson(json),
'text' => ConversationTextContent.fromJson(json),
'summary_text' => ConversationSummaryTextContent.fromJson(json),
'reasoning_text' => ConversationReasoningTextContent.fromJson(json),
'image_url' => ConversationImageUrlContent.fromJson(json),
_ => ConversationUnknownContent(type: type, data: json),
};
}