Content.fromJson constructor
Implementation
factory Content.fromJson(Map<String, dynamic> json) {
final type = json['type'] as String;
return switch (type) {
'text' => TextContent.fromJson(json),
'image' => ImageContent.fromJson(json),
'audio' => AudioContent.fromJson(json),
'resource' => ResourceContent.fromJson(json),
'resource_link' => ResourceLinkContent.fromJson(json),
_ => throw ArgumentError('Unknown content type: $type'),
};
}