Content.fromParts constructor
Creates user content from multiple parts.
Accepts strings (auto-wrapped to TextPart) or Part objects.
Example:
final content = Content.fromParts([
'Describe this image:',
Part.base64(imageData, 'image/png'),
]);
Implementation
factory Content.fromParts(List<Object> parts, {String role = 'user'}) {
return Content(
role: role,
parts: parts.map((p) {
if (p is String) return TextPart(p);
if (p is Part) return p;
throw ArgumentError('Expected String or Part, got ${p.runtimeType}');
}).toList(),
);
}