cutFaceFromImageBytes function Null safety

Future cutFaceFromImageBytes(
  1. dynamic imgBytes,
  2. dynamic rect
)

Cuts out the face from encoded image imgBytes

Implementation

Future<Image> cutFaceFromImageBytes(Uint8List imgBytes, Rectangle rect) async {
  final img2 = await cutFaceImageFromImageBytes(imgBytes, rect);

  imglib.PngEncoder pngEncoder = new imglib.PngEncoder(level: 0);
  List<int> png = pngEncoder.encode(img2);
  return Image.memory((png as Uint8List));
}