compressAndGetFile static method

Future<File?> compressAndGetFile(
  1. File file,
  2. String targetPath, {
  3. int minWidth = 1920,
  4. int minHeight = 1080,
  5. int quality = 85,
})

压缩图片

file 文件 targetPath 保存路径 minWidth 宽度 minHeight 高度 quality 质量

Implementation

static Future<File?> compressAndGetFile(File file, String targetPath,
    {int minWidth = 1920, int minHeight = 1080, int quality = 85}) async {
  final File? result = await FlutterImageCompress.compressAndGetFile(
    file.absolute.path,
    targetPath,
    minWidth: minWidth,
    minHeight: minHeight,
    quality: quality,
  );
  return result;
}