ImagePromptPart.fromBytes constructor

ImagePromptPart.fromBytes(
  1. Uint8List bytes
)

Create ImagePromptPart from Uint8List bytes

Implementation

factory ImagePromptPart.fromBytes(Uint8List bytes) {
  final base64String = base64Encode(bytes);
  // Assume PNG format, could be enhanced to detect format
  final dataUrl = 'data:image/png;base64,$base64String';
  return ImagePromptPart(dataUrl);
}