compressAndGetFile static method
Implementation
static Future<File?> compressAndGetFile(File file, {int quality = 10}) async {
final fileSample = File(
'${(await getTemporaryDirectory()).path}/fotoSample${DateTime.now().microsecondsSinceEpoch}.jpg');
var result = await FlutterImageCompress.compressAndGetFile(
file.absolute.path,
fileSample.path,
quality: quality,
);
File? file2;
if (result != null) {
file2 = File(result.path);
} else {
file2 = file;
}
return file2;
}