flutter_video_compress
flutter_video_compress copied to clipboard
Null check operator used on a null value
Description
.mp4 file compression is pretty good but when i pick .mov file to compress it's couldn't able to compress and file path throwing null exception.
Platform
IOS|Android|Both|Other
Code Example (if has)
for (var element in dto.media) {
var file = await PhotoGallery.getFile(mediumId: element.id);
Uint8List? data;
if (element.mediumType == MediumType.image) {
data = await AppUtils.compressToUint8List(
file.path, element.height, element.width, 50);
files.add(MultipartFile.fromBytes(data!,
filename: getFileName(element.filename!)));
} else {
log("File name ===========> ${file.path}");
log("Compress Start ===========> ${DateTime.now()}");
try {
showProgressDialogStatus(0);
final response = await vc.VideoCompress.compressVideo(
file.path,
quality: vc.VideoQuality.MediumQuality,
// deleteOrigin: false, // It's false by default
);
log("File path ===========> ${response!.path}");
log("Compress end ===========> ${DateTime.now()}");
var multipart = await MultipartFile.fromFile(response.path!,
filename: getFileName(response.path!));
files.add(multipart);
} catch (e) {
log("compress error ===========> $e");
}
}
}