ImagePromptPart.fromBytes constructor

ImagePromptPart.fromBytes(
  1. Uint8List bytes
)

Create ImagePromptPart from Uint8List bytes

Implementation

factory ImagePromptPart.fromBytes(Uint8List bytes) {
  final base64String = base64Encode(bytes);
  final mimeType = _detectImageFormat(bytes);
  final dataUrl = 'data:$mimeType;base64,$base64String';
  return ImagePromptPart(dataUrl);
}