ImagenInlineImage.fromJson constructor

ImagenInlineImage.fromJson(
  1. Map<String, dynamic> json
)

Factory method to create an ImagenInlineImage from a JSON object.

Implementation

factory ImagenInlineImage.fromJson(Map<String, dynamic> json) {
  final mimeType = json['mimeType'] as String;
  final bytes = json['bytesBase64Encoded'] as String;
  final decodedBytes = base64Decode(bytes);
  return ImagenInlineImage(
    mimeType: mimeType,
    bytesBase64Encoded: Uint8List.fromList(decodedBytes),
  );
}