When calling FlutterImageUtilities.saveAsJpeg, on Android the parameters maxWidth and minWidth don't have to be supplied (they are optional in the Dart API). However, if they are not supplied, then there is a crash in iOS, because of the use of the ! operator:
ImageUtils.swift:
// save scaled and compressed image to destination file with the original metadata
let file = try sourceImage!.saveAsJpeg(
destinationFile: destinationImageFile,
imageQuality: quality,
maxSize: Size(width: maxWidth!, height: maxHeight!), // <------- crashes
canScaleUp: canScaleUp,
properties: sourceImageProperties
)
When calling
FlutterImageUtilities.saveAsJpeg, on Android the parametersmaxWidthandminWidthdon't have to be supplied (they are optional in the Dart API). However, if they are not supplied, then there is a crash in iOS, because of the use of the!operator:ImageUtils.swift:// save scaled and compressed image to destination file with the original metadata let file = try sourceImage!.saveAsJpeg( destinationFile: destinationImageFile, imageQuality: quality, maxSize: Size(width: maxWidth!, height: maxHeight!), // <------- crashes canScaleUp: canScaleUp, properties: sourceImageProperties )