Picture constructor

Picture(
  1. List<int> imageData
)

Create an instances of Picture class.

Implementation

Picture(List<int> imageData) {
  img.Image? image;
  if (isPng(imageData)) {
    image = img.decodePng(imageData as Uint8List);
  } else if (isJpeg(imageData)) {
    image = img.decodeJpg(imageData as Uint8List);
  }
  _imageData = imageData;
  if (image != null) {
    height = image.height;
    width = image.width;
  }
}