captureRawImageF method Null safety

Future<List<RawSample>> captureRawImageF(
  1. RawImageF image
)

Implementation

Future<List<RawSample>> captureRawImageF(RawImageF image) async {
  ReceivePort receivePort = ReceivePort();
  List<RawSample> result = [];
  DynamicLibrary dylib = DynamicLibrary.open(_dllPath);

  _sendPort.send({
    "event": _CapturerEvents.CAPTURE_RAW_IMAGE_F,
    "sendPort": receivePort.sendPort,
    "width": image.width,
    "height": image.height,
    "format": image.format,
    "data": image.data.address,
    "with_crop": image.with_crop,
    "crop_info_offset_x": image.crop_info_offset_x,
    "crop_info_offset_y": image.crop_info_offset_y,
    "crop_info_data_image_width": image.crop_info_data_image_width,
    "crop_info_data_image_height": image.crop_info_data_image_height
  });

  List<int> pointers = await receivePort.first;

  pointers.forEach((address) => result.add(RawSample(dylib, Pointer<Void>.fromAddress(address))));

  return result;
}