toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  if (this is TextPart) return (this as TextPart).toJson();
  if (this is MediaPart) return (this as MediaPart).toJson();
  if (this is ToolRequestPart) return (this as ToolRequestPart).toJson();
  if (this is ToolResponsePart) return (this as ToolResponsePart).toJson();
  if (this is CustomPart) return (this as CustomPart).toJson();
  if (this is ReasoningPart) return (this as ReasoningPart).toJson();
  if (this is ResourcePart) return (this as ResourcePart).toJson();
  throw Exception('Unknown subtype of Part');
}