From 49cff485e98ea3f578c168b7b162afd190226a41 Mon Sep 17 00:00:00 2001 From: Sasha Denisov Date: Mon, 16 Mar 2026 23:26:38 +0700 Subject: [PATCH] Fix cancel download not working due to missing async/await in then callback The whenComplete cleanup was firing immediately because _downloadWithSmartRetry was not awaited inside the then() callback, causing the cancellation listener to be disposed before the download completed. --- lib/mobile/smart_downloader.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mobile/smart_downloader.dart b/lib/mobile/smart_downloader.dart index 7177a3fe..4b0a9eed 100644 --- a/lib/mobile/smart_downloader.dart +++ b/lib/mobile/smart_downloader.dart @@ -184,8 +184,8 @@ class SmartDownloader { } // Configure FileDownloader and start download - _ensureConfigured(foreground).then((_) { - _downloadWithSmartRetry( + _ensureConfigured(foreground).then((_) async { + await _downloadWithSmartRetry( url: url, targetPath: targetPath, token: token,