From 38d46bb05fa7a7688ca3e2a8bba7d1f93fff543b Mon Sep 17 00:00:00 2001 From: Pratik-canopas Date: Fri, 13 Dec 2024 11:21:00 +0530 Subject: [PATCH] Fix media preview delete image error --- .../network_image_preview_view_model.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/lib/ui/flow/media_preview/components/network_image_preview/network_image_preview_view_model.dart b/app/lib/ui/flow/media_preview/components/network_image_preview/network_image_preview_view_model.dart index 44e5a11..4f60eaf 100644 --- a/app/lib/ui/flow/media_preview/components/network_image_preview/network_image_preview_view_model.dart +++ b/app/lib/ui/flow/media_preview/components/network_image_preview/network_image_preview_view_model.dart @@ -90,8 +90,10 @@ class NetworkImagePreviewStateNotifier } @override - void dispose() { - tempFile?.deleteSync(); + Future dispose() async { + if (tempFile != null && await tempFile!.exists()) { + await tempFile!.delete(); + } cancelToken?.cancel(); super.dispose(); }