Skip to content

Fix: cancel download not working#196

Merged
DenisovAV merged 1 commit intoDenisovAV:mainfrom
mduccc:fix/cancel-download
Apr 4, 2026
Merged

Fix: cancel download not working#196
DenisovAV merged 1 commit intoDenisovAV:mainfrom
mduccc:fix/cancel-download

Conversation

@mduccc
Copy link
Copy Markdown
Contributor

@mduccc mduccc commented Mar 16, 2026

Problem

Cancelling a download via CancelToken had no effect — the download continued running even after cancellation was requested.

Root Cause

In SmartDownloader.downloadWithProgress(), the .then() callback was not async and _downloadWithSmartRetry() was not awaited:

// Before (broken)
_ensureConfigured(foreground).then((_) {
  _downloadWithSmartRetry(...);  // unawaited!
}).whenComplete(() {
  cancellationListener?.cancel();  // fires immediately!
});

…llback

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.
@mduccc
Copy link
Copy Markdown
Contributor Author

mduccc commented Apr 4, 2026

Hi @DenisovAV , any chance you could take a look at this when you have time? Thanks!

@DenisovAV DenisovAV merged commit 2efc470 into DenisovAV:main Apr 4, 2026
@DenisovAV
Copy link
Copy Markdown
Owner

Thanks @mduccc, sorry for the delay — merged! 🙏

DenisovAV added a commit that referenced this pull request Apr 4, 2026
- LiteRT-LM 0.10.0 (Android + JVM SDK)
- Gemma 4 thinking mode via extraContext + streaming thought channels
- Fix cancel download (#196)
- Fix large_file_handler conditional imports for pub.dev platform support
- Update desktop JAR version and checksums in all platform scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants