Disabled asset change notifying only after getFile() is done on downloading a file

This commit is contained in:
ashilkn 2023-01-05 09:48:17 +05:30
parent 39bfd985bb
commit 8fd62127f8

View file

@ -411,15 +411,15 @@ class FadingAppBarState extends State<FadingAppBar> {
Future<void> _download(File file) async {
final dialog = createProgressDialog(context, "Downloading...");
await dialog.show();
//Disabling notifications for assets changing to insert the file into
//files db before triggering a sync.
PhotoManager.stopChangeNotify();
try {
final FileType type = file.fileType;
final bool downloadLivePhotoOnDroid =
type == FileType.livePhoto && Platform.isAndroid;
AssetEntity? savedAsset;
final io.File? fileToSave = await getFile(file);
//Disabling notifications for assets changing to insert the file into
//files db before triggering a sync.
PhotoManager.stopChangeNotify();
if (type == FileType.image) {
savedAsset = await PhotoManager.editor
.saveImageWithPath(fileToSave!.path, title: file.title!);