Skip to content

maxWidth and maxHeight are optional on Android but required on iOS (causing a crash on iOS if not supplied) #5

@lukehutch

Description

@lukehutch

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
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions