convertCameraImageToBytes static method

Future<Uint8List?> convertCameraImageToBytes(
  1. CameraImage cameraImage, {
  2. int? rotation,
})

Converts a CameraImage in YUV420 format to Image in RGB format

Implementation

static Future<Uint8List?> convertCameraImageToBytes(CameraImage cameraImage,
    {int? rotation}) async {
  await ImageUtilsIsolate.init();

  return (await ImageUtilsIsolate.computer.compute(_convertCameraImageToBytes,
              param: _getParamsBasedOnType(cameraImage, rotation: rotation))
          as TransferableTypedData?)
      ?.materialize()
      .asUint8List();
}