| static Future<File> compressImage(File file) async { | static Future<File> compressImage(File file) async { | ||||
| final dir = await path_provider.getTemporaryDirectory(); | final dir = await path_provider.getTemporaryDirectory(); | ||||
| final fileName = path.basenameWithoutExtension(file.path); | final fileName = path.basenameWithoutExtension(file.path); | ||||
| final targetPath = dir.absolute.path + "/$fileName.jpg"; | |||||
| final targetPath = dir.absolute.path + "/compress_{$fileName}.jpg"; | |||||
| final imgFile = await compressAndGetFile(file, targetPath); | final imgFile = await compressAndGetFile(file, targetPath); | ||||
| return File(imgFile?.path ?? ''); | return File(imgFile?.path ?? ''); | ||||
| } | } |