background_downloader 9.7.1
background_downloader: ^9.7.1 copied to clipboard
A multi-platform background file downloader and uploader. Define the task, enqueue and monitor progress
9.7.1 #
Added #
- All: Add opt-in resumable and multipart upload protocols built purely in Dart on top of
LogicalTask(addresses #646):- TUS 1.0.0 via
package:background_downloader/tus.dart(TusUploadTask,registerTusLogicalTaskHandler) with pure-DartHEADoffset recovery - AWS S3 & S3-compatible Multipart via
package:background_downloader/s3.dart(S3MultipartUploadTask,registerS3LogicalTaskHandler,S3SubTaskMeta,S3SubTaskPhase) with concurrent part uploads and pre-signed URL re-signing support viaonTaskStart/Auth - Google Cloud Storage (GCS) Resumable via
package:background_downloader/gcs.dart(GcsUploadTask,registerGcsLogicalTaskHandler) with pure-Dart308 Resume IncompleteandRangechunk acknowledgement handling
- TUS 1.0.0 via
- All: Add
taskIdsToResumetoLogicalTaskResponsesoLogicalTaskHandlerimplementations can resume specific paused sub-tasks by ID across Android, iOS, and Desktop
Changed #
- All: Standardize on
Transfers.getOrStartAlland deprecateTransfers.startOrGetAll - Android: Update
GroupNotificationprogress bar and{progress}token continuously while tasks are running (throttled to at most once per second and whole-percent changes), and guardshowsProgresson a non-null running notification config (refs #768)
Fixed #
- Desktop: Preserve
Rangeheader across binary upload retries by stripping it only from outgoing HTTP request headers instead of mutatingtask.headersin place - iOS: Clear per-task state dictionaries (including
tasksWithModifications) on finalLogicalTasksub-task status updates before returning early intoLogicalTaskManager, preventing stale modified tasks from triggering infinite native retry loops
Docs #
- Reorganize
doc/logical_tasks.mdaround concepts, custom handlers, bundled protocols (HLS, MPEG-DASH, TUS, S3, GCS), andCallbackTask, surface supported protocols inREADME.md, and updatedoc/uploads.md,doc/lifecycle.md,doc/CONFIG.md,doc/transfers.md,doc/notifications.md, anddoc/topic_index.md
9.7.0 #
Introduction of native SQLite backed storage improves reliability and made it possible to introduce new, complex features:
- Logical tasks for building complex multi-step protocols on top of the downloader. Example protocol implementations now included through explicit import: HLS and MPEG-DASH
- Optional callback task for running Dart code (unrelated to downloading or uploading) which is powerful if combined with
- Scheduled tasks, scheduled to run at an
earliestStartTime - Dependent/chained tasks, that won't run until
startAfterTaskIdstasks have finished, potentially with aTaskStatuscondition defined instartAfterRequires. These are great for running tasks in a specific order, with conditions (e.g. for a clean-up after all downloads succeeded)
- Scheduled tasks, scheduled to run at an
Added #
- All: Introduce Logical Tasks (
LogicalTask&LogicalTaskHandler) — pure-Dart multi-step protocol extensions orchestrated by native/desktop engines, including headless background isolate wake-ups when suspended or killed on iOS and Android:- Unified lifecycle (
onStart,onSubTaskStatusUpdate,onSubTaskResumeData,onPause,onResume,onCancel) with automaticTaskStatus.enqueued→TaskStatus.runningtransitions, per-task persisted JSON state, scratch working directories, weighted progress aggregation, and automatic native sub-task retries - Opt-in HLS (
.m3u8) support viapackage:background_downloader/hls.dart(HlsDownloadTask,registerHlsLogicalTaskHandler): VOD master/media playlists, variant selection,#EXT-X-KEY/#EXT-X-MAP/#EXT-X-BYTERANGE, andlocalPlaylist/stitchSegmentsoutput modes - Opt-in MPEG-DASH (
.mpd) support viapackage:background_downloader/dash.dart(DashDownloadTask,registerDashLogicalTaskHandler):SegmentTemplate/SegmentTimeline/SegmentList/SegmentBase, multi-track video+audio selection, andlocalManifest/stitchSegmentsoutput modes - Opt-in CallbackTask support via
package:background_downloader/callback_task.dart(CallbackTask,registerCallbackLogicalTaskHandler): run top-level@pragma('vm:entry-point')Dart functions now or at a scheduled time and return results viaTaskStatusUpdate.responseBody/transfer.result
- Unified lifecycle (
- All: Add Scheduled Tasks via
TaskOptions.earliestStartTimefor best-effort "not before" deferred execution ofDownloadTask,UploadTask,DataTask,LogicalTask, andCallbackTask:- Android: Persisted in
NativeStoreand triggered by aWorkManagerdelayedScheduledTaskWorker(survives app termination and reboots) - iOS: Persisted in
NativeStoreand scheduled viaURLSessionTask.earliestBeginDate(using a zero-byte canceled sentinelURLSessionDownloadTaskforLogicalTaskwake-ups) - Desktop: Scheduled with an in-process Dart
Timerwhile the app process is running - Full integration with
allTasks,taskForId,cancel,reset,pause/resume, andHoldingQueue
- Android: Persisted in
- All: Add Dependent / Chained Tasks via
TaskOptions.startAfterTaskIdsandTaskOptions.startAfterRequires(also exposed directly onCallbackTask.create):- Support multi-task fan-in, fan-out, and chaining (wait for all listed
taskIds to finish:TaskStatus.completerequires all to complete,nullaccepts any final outcome, andfailed/notFound/canceledwaits for all to finish and runs if any matched), composable withTaskOptions.earliestStartTime - Maintain a 10-second recent-completions window so fast-finishing prerequisites still satisfy immediately following enqueues, while missing, unsatisfied, or cyclic dependencies cleanly reject
enqueue()withfalse - Cancel waiting dependent tasks automatically when
startAfterRequiresis not satisfied (cascading downstream onTaskStatus.completefailure) and purge stale >24h dependent tasks every 100 store accesses - Full integration across Android, iOS, and Desktop (
allTasks,taskForId,cancel,reset,pause/resume,HoldingQueue, andNativeStore)
- Support multi-task fan-in, fan-out, and chaining (wait for all listed
- Example: Add live HLS (
HlsDownloadTask) download workflow, 1-minute scheduledCallbackTaskworkflow, and multi-task dependent/chained workflow (Step 1A+Step 1B→Step 2) toexample/lib/main.dart
Changed #
- Android, iOS: Replace legacy
SharedPreferences/UserDefaultstask storage with a unified, WAL-mode SQLiteNativeStore(with automatic one-time migration), significantly improving background execution reliability, crash resilience, and concurrency safety across persisted status/progress updates, resume data, temp upload files,HoldingQueue,LogicalTasks, retries, and scheduled tasks - Android, iOS: Refactor
HoldingQueueonto persistent SQLiteNativeStorestorage and fix queue concurrency and lifecycle bugs - Android, iOS: Move task retry orchestration to native (
NativeRetrybacked byWorkManageron Android andURLSessionTask.earliestBeginDateon iOS) so retries survive app suspension and termination reliably - Android, iOS: Harden pre- and post-execution native callbacks (
beforeTaskStart,onTaskStart,onTaskFinished,onAuth) for suspended and killed apps
Fixed #
- All: Prevent
TransferProgressBarhorizontal overflow, stop indeterminate progress animation on canceled/failed/notFound transfers, addTransferListTile.contentPadding, align allTransferButtontrailing icons consistently, standardizefailed/notFound/canceledretry icons onIcons.refresh, and addshowRetryButton(defaulttrue) onTransferButtonandTransferListTile
Docs #
- Add
doc/logical_tasks.mdcoveringLogicalTask, HLS, MPEG-DASH, andCallbackTask, and documentTaskOptions.earliestStartTimeandstartAfterTaskIds/startAfterRequiresindoc/lifecycle.md,doc/topic_index.md, andREADME.md
9.6.8 #
Security #
- All: Enforce filename/directory sanitization, canonical path containment across dangling symlinks, and URI delimiter injection guards
- All: Harden HTTP redirects (strip cross-origin auth headers), URL scheme and enqueue validation, RFC 6265 cookie matching, random multipart boundaries, header sanitization, credential log redaction, and debug-gated TLS bypass
- Desktop: Replace shell-based
openFilewith non-shell invocation
Changed #
- iOS: Declare
DiskSpaceandFileTimestampAPI reasons inPrivacyInfo.xcprivacy - Desktop: Apply
requestTimeoutto upload response wait rather than total upload duration
Fixed #
- All: Fix deadlocks in
Transfer.allowCellular/resume, duplicate/clobbered updates inTransfers, stall watchdog scoping, and pause-before-resume synchronization - All: Scope
FileDownloader.scopednamespaces consistently acrossrescheduleKilledTasks,trackTasks,pauseAll,resumeAll, and notification configs; fix all-groupcancelAll/pauseAll - All: Lazily initialize
Transfers, handle failed/batch enqueues cleanly, preserveexpectedFileSizein DB, completeawaitTasks/canResumeTaskonreset, and fixDownloadProgressIndicatorstate/rebuild bugs - All: Fix
TransferHint.allowPauseon non-GET tasks, balanceParallelDownloadTaskchunk ranges/validation, fixMultiUploadTaskduplicate file multipart terminator loops, fixMemoryTaskQueue.reset(group:)and enqueue rollback, and fixLocalstore0-byte reads, cache evictions, and isolate lifecycle - Desktop: Fix race reporting 200 OK uploads as failed, free slots on
beforeTaskStart, await asynconTaskFinished, fixParallelDownloadTaskstitching/cancel races, and catch isolate/mTLS client creation errors cleanly - Android: Harden
TaskWorker/UIDTJobServiceforeground exceptions, notification config/channel guards,HoldingQueueAPI 23 locking,TaskRunnercancel/disconnect races,BDPluginlifecycle andQueueServiceordering,ParallelDownloadTaskRunner/UploadTaskRunnersynchronization and cleanup,UriUtilsI/O offloading and fallbacks, and UIDT notification finalization (refs #753) - iOS: Merge notification categories instead of overwriting other plugins, run
Callbackson main thread, hardenUrlSessionDelegate/HoldingQueue/WiFiQueueconcurrency, moveParallelDownloaderchunk stitching off main thread and align pause/resume lifecycle with Android/Desktop, persist temp upload cleanup, closeUploaderfile handles, and fixUriUtils/OpenFilesecurity-scoped access,Rangeparsing,TaskExceptiondecoding, and case-insensitiveContent-Typeextraction
Docs #
- Fix platform accuracy notes, broken code snippets, Dartdocs, and broken markdown links/anchors across
README.mdanddoc/
9.6.7 #
Changed #
- All: Migrate from deprecated Flutter
material.dart/cupertino.dartimports tomaterial_uiandcupertino_ui - All: Refactor eligible Dart classes to primary constructors and resolve lint warnings
- Android: Store notification tap payloads locally and open viewed files read-only
- Example: Migrate iOS example app to
UIScenelifecycle
Fixed #
- All: Guard non-positive, non-finite, and overflowing
timeRemainingin progress updates across iOS, Desktop, and Android (closes #764) - All: Fix persistent storage initialization when the Documents directory is unavailable (closes #755)
- All: Avoid mutating
Logger.rootinFileDownloader.request(refs #761) - All: Send canceled status to notification when canceling tasks waiting to retry
- Android: Preserve per-job UIDT foreground notifications in group notifications (refs #763)
- Android, iOS: Track
numFailedinGroupNotificationgroupState - iOS: Compare
Taskequality and hash bytaskIdonly (#765) - iOS: Align error and upload notification updates on retry with Android
Docs #
- iOS: Clarify SwiftPM permission bypass environment and caching behavior (refs #762)
9.6.4 #
Fixed #
- All: Bug fixes
- Android: Reuse pre-created notification channel and preserve its importance (#732, #733)
9.6.3 #
Changed #
- All: Raise HTTP redirect limit to 10 for desktop and foreground requests
- Android: Remove
androidx.test:monitorfrom implementation dependencies
Fixed #
- iOS: Fix group notification completion cleanup when notification is unconfigured: ensure
GroupNotificationregistry cleanup is executed upon group completion regardless of whethererrororcompletenotification contents are configured, preventing an unconfigured slot from permanently suppressing subsequent group completion notifications (fixes #728) - iOS: Fix group completion notification de-duplication: always post finished group notifications (
isFinished == true), bypassing delivered notification de-duplication so consecutive batches with identical completion text are not skipped (fixes #729)
9.6.2 #
Fixed #
- All: Fix task updates stream suppression when task tracking or transfers is enabled: isolate internal
Transferscallbacks from user-registered callbacks using dedicatedgroupTransfercallback maps inBaseDownloader, preventing internal callbacks from suppressing events onFileDownloader().updates, and preserving callback reference equality inregisterCallbacks/unregisterCallbacks(fixes #727) - Android: Fix Kotlin compiler warnings: align serializer visibility with public enums in
Models.kt, remove unnecessary safe calls inUIDTJobService.kt, and streamlineUriUtils.kt
9.6.1 #
Added #
- iOS: Add optional static closures
BDPlugin.onNativeTaskStatusChangeandBDPlugin.onNativeTaskProgressChangeonBDPluginto allow native iOS host apps to observe task status and throttled progress directly in Swift (e.g. for Live Activities and WidgetKit) when the Dart isolate is suspended during background URLSession wake-ups (closes #702, refs #705)
Changed #
- All: Expand
connectivity_plusversion constraint to>=6.1.3 <8.0.0to supportconnectivity_plus7.x (fixes #722) - Android: Enforce Wi-Fi constraint via
NetworkRequeston Android API 28+: requireTRANSPORT_WIFIandNET_CAPABILITY_INTERNETfor tasks requiring Wi-Fi, preventing downloads over cellular even when reported as unmetered by the carrier, with fallback toNETWORK_TYPE_UNMETEREDon older Android versions (fixes #717) - iOS: Partial upload slicing optimization: use
FileHandle.seek(toOffset:)instead of reading and discarding leading bytes increateTempFileWithRange, eliminating quadratic disk reads when slicing chunked uploads (#723)
Fixed #
- CI: Fix Android R8 build error in CI and update minimum Flutter SDK in CI (#725)
Docs #
- Android: Clarify
requiresWiFibehavior on Android API 28+ vs earlier Android versions
9.6.0 #
Added #
- All: Introduce the
transfersobject and Transfer API — a major new high-level reactive abstraction for managing background downloads, uploads, and data tasks viaFileDownloader().transfers:- Dedicated transfer manager: accessed via
FileDownloader().transfers(Transfersclass), providing methods to start, batch start, reconnect to, and query background transfers - First-class
Transferhandle returned bytransfers.start,startAll,getOrStart, andstartOrGetAll - Automatic status update promotion: tasks enqueued through
transfersare automatically ensured to provide status updates (Updates.statusAndProgressorUpdates.status) for reliable lifecycle tracking - Database persistence & rehydration:
getOrStartandstartOrGetAllre-attach to existing active transfers or rehydrate matching records from the persistent database across app restarts;transfers.rehydrateFromDatabase({group})restores previously tracked transfers into active handles - Direct awaitable futures:
transfer.file(resolves to the completedFile, dynamically tracking server-suggested filenames if renamed upon completion),transfer.result(resolves to finalTaskStatusUpdate), andtransfer.responseBody - Reactive
ValueNotifierproperties for Flutter UI:statusNotifier,progressNotifier(normalized0.0–1.0),networkSpeedNotifier(MB/s),timeRemainingNotifier,holdReasonNotifier,exceptionNotifier, andnotificationTapNotifier - Direct action controls on the handle:
pause(),resume(),cancel(), andallowCellular() - Robust resumption & retries:
resume()andallowCellular()fall back to re-enqueuing if resume data is missing; resets result completers cleanly upon retry and re-enqueue; native handling for Wi-Fi and network constraints - Smart tuning with
TransferHintpresets (userInitiated,largeFile,smallFile,lowPriority,useSuggestedFilename,binaryUpload) with automatic Android 14+ UIDT JobScheduler configuration and pause resilience - Pre-built reactive Flutter widgets:
TransferProgressBar(with accurate 100% completion display),TransferButton(with optionalonCancelcallback), andTransferListTile - Transfer collections and reactive notifications:
transfers.notifier(ValueNotifier<List<Transfer>>),transfers.all(),active(),completed(),failed(),forId(),forTask(), andforUrl() - Lifecycle management and cleanup:
transfers.remove(),removeById(),cancelAll(), andclear({cancelActive})with automatic disposal of transfer instances - Chained group callbacks: registers internal group listeners seamlessly without overwriting user-registered callbacks
- Automatic database cleanup: activates periodic cleanup (
autoClean) on first transfer start when task tracking is enabled - Scoped namespaces via
FileDownloader.scoped('namespace')for modular apps, plugins, and feature isolation - Network resilience: automatic offline holding (
TransferHoldReason.offline,waitingForWiFi) with auto-resumption and configurablestallTimeoutwatchdog - Dedicated documentation in
doc/transfers.mdand overhauled example app demonstratingTransferbest practices
- Dedicated transfer manager: accessed via
- Tests: Add device selection options (
-d/--device,--ios,--android,--macos) and--dry-runflag torun_tests.sh, grouping test runs by device to prevent redundant app rebuilds
Changed #
- All: Upgrade modern Dart & SDK constraints:
- Bump minimum Dart SDK to
^3.13.0and Flutter requirement to>=3.47.0 - Modernize codebase using latest Dart language features: primary constructors, concise constructor syntax, enum dot shorthands, switch expressions, and pattern matching for improved readability and maintainability
- Upgrade
flutter_lintsto^6.0.0with updated analysis options
- Bump minimum Dart SDK to
- Android: Keep concurrent running download notifications in stable order: pin notification timestamp (
when) to task creation time, set task ID as deterministic sort key, and enableonlyAlertOnce, preventing notifications from jittering and swapping positions on every progress update (closes #714) - Android: Native Wi-Fi / unmetered queuing: enqueue tasks natively when waiting for Wi-Fi or unmetered network rather than holding in Dart
- Android: Upgrade Android Gradle Plugin to 9.0.1, Kotlin to 2.3.20, and Gradle wrapper to 9.1.0 in example app
- Android: Remove obsolete
android.defaults.buildfeatures.buildconfigproperty from example appgradle.properties(closes #674 / AGP 9 compatibility) - iOS: Modernize Swift Package Manager (SwiftPM) support: add required
FlutterFrameworkdependency inPackage.swift, expand permissions bypass documentation for SwiftPM, and transition example app (iosandmacos) to pure SwiftPM - iOS: Log notification taps without an associated task as info instead of error
- Desktop: Case-insensitive host matching and cache key normalization for mTLS client configuration cache in
DesktopDownloader - Tests: Stabilize flaky integration tests and benchmarks in
load_test.dart,database_test.dart, andgeneral_test.dart
Fixed #
- Android: Apply
readTimeoutmatchingrequestTimeoutonHttpURLConnectionand properly classifySocketTimeoutExceptionas a connection exception, preventing tasks from blocking indefinitely when waiting for response headers - iOS: Fix group notification dismissal: use
groupNotification.notificationIdrather thantask.taskIdinupdateGroupNotificationto properly dismiss group notifications (fixes #718) - iOS: Fix notification category for group notifications: explicitly assign
.runningWithoutPause,.complete, or.errorcategory soUNUserNotificationCenterDelegate.willPresentrecognizes and delivers running and finished group notifications (fixes #718) - Desktop: Apply
requestTimeouttoclient.send(request)indoDownloadTaskanddoDataTask, and toheadindoParallelDownloadTask, preventing tasks from hanging indefinitely inrunningstatus if the network drops or the server stalls while waiting for response headers (fixes #721)
Docs #
- Clarify
requireWiFiplatform behavior: enforces an unmetered network connection constraint (NETWORK_TYPE_UNMETERED) on Android (excluding cellular and metered Wi-Fi hotspots), while disabling cellular access (allowsCellularAccess = false) on iOS (allowing any Wi-Fi or Ethernet connection regardless of metered status) - Android: Document Android 14+ UIDT JobScheduler behavior, 2-minute execution limit for standard expedited tasks, and
android.permission.RUN_USER_INITIATED_JOBSrequirement - Android, Desktop: Document
Config.tempFilePathfor custom temporary download file storage on Android and Desktop - Document mTLS client certificate configuration with custom server CA certificates (
serverCertificatePath/serverCertificateBytes)
9.5.9 #
Added #
- All: Add
Config.tempFilePathto allow configuring a custom temporary directory path for downloads (closes #712) - Desktop: Add
Config.mTLSandMTLSConfigdata class to support mutual TLS client authentication on desktop platforms (closes #711)
Changed #
- All: Reduce default task timeout for expedited tasks to 2 minutes
- Android: Improve UIDT JobService stop detection, reschedule contract, and notification policy
Fixed #
- Android: Fix WorkManager crash when enqueuing expedited tasks with initial delays (fixes #709)
- Android: Properly configure Android 14+ UIDT JobInfo and add fallback to WorkManager (fixes #710)
- Android: Fix thread safety and memory leaks in
HoldingQueueand batch-drain available concurrency slots - Android: Eliminate deadlock risk in WiFi requirement lock with watchdog timeout
- Android: Resolve coroutine hang in
Callbackswhen callback handle is missing or invalid - Android: Add copy+delete fallback for cross-device moves in
DownloadTaskRunner - Android: Prevent
InputStreamresource leaks inUploadTaskRunner - Android: Delete incomplete MediaStore entry upon
moveToSharedStoragefailure - Android: Clean up partial multipart file if creation fails in
UploadTaskRunner - iOS: Prevent
stateLockcontention during network I/O inHoldingQueueand batch-drain concurrency slots - iOS: Prevent
pauseSingleTaskrace condition and stalled task state - iOS: Synchronize access to
uploaderForUrlSessionTaskIdentifier - Desktop: Ensure temporary download files are cleaned up upon completion of resumed downloads
- Desktop: Preserve partial download temp files on resume failures for subsequent retries
Docs #
- Clarify single-subscription nature of
FileDownloader.updatesstream (fixes #708)
9.5.8 #
Added #
- All: Add
alsoRestartUploadsparameter toFileDownloader.requireWiFito optionally cancel and restart running upload tasks when updating WiFi requirement (fixes #695)
Fixed #
- iOS: Fix typo in
PrivacyInfo.xcprivacyfor photos and videos data collection key (NSPrivacyCollectedDataTypePhotosorVideos), resolving App Store submission validation errors (fixes #694)
Docs #
- Add comprehensive documentation for
TaskStatusUpdateandTaskProgressUpdateindoc/status_updates.md(fixes #684)
9.5.7 #
Fixed #
- All: Defer
JsonProcessoridle shutdown while requests are pending to prevent unexpected background isolate shutdown errors - Android: Fix group notification sticking in running state when cancelling tasks from holding queue
- Android: Fix
ConcurrentModificationExceptionincanSendCancellationwhen processing concurrent status updates - iOS: Fix group notification sticking in running state when cancelling tasks from holding queue
- iOS: Serialize access to group notification registry to prevent
EXC_BAD_ACCESSrace condition under concurrent status updates
9.5.6 #
Changed #
- Android: Add fallback to legacy
kotlin-androidplugin in Gradle build ifbuiltInKotlinis configured tofalse(closes #674) - iOS: Restore compatibility with older Flutter SDKs in the example app's
AppDelegate.swift - CI: Update GitHub Actions workflow configurations to resolve Node 20 deprecation warnings
Fixed #
- Android: Fix Application Not Responding (ANR) crash when canceling binary uploads via notification action (fixes #664)
- Android: Correct ETag validation logic and save the correct server ETag during a timeout-pause (fixes #683)
- iOS: Resolve Swift Package Manager (SPM) package dependency resolution errors by removing invalid
FlutterFrameworkdependency path inPackage.swift
9.5.5 #
Changed #
- All: Update code formatting to match the latest Dart formatter
- Android: Migrate build configuration to Flutter's built-in Kotlin Gradle plugin configuration and upgrade Gradle to 8.14
- iOS: Migrate the example app to native Swift Package Manager (SPM) and add environment-variable-based compile-time permission bypass flags for SPM users
- iOS: Remove 'Background Fetch' requirement from documentation and example plist files, preventing unexpected wake-ups when the device is locked and resolving potential keychain access issues (fixes #668)
- Desktop: Add fallback to the target download directory on desktop platforms when the system temporary directory is inaccessible (e.g., in macOS app sandbox mode, fixes #649)
Fixed #
- Android: Fix a potential UI freeze during application startup
- Android: Prevent App Not Responding (ANR) crashes when tapping notification actions (Cancel/Pause/Resume) under heavy system load
- Android: Fix group notifications running in the foreground (issue #648)
- iOS: Fix redundant updates and visual "flashing" of group notifications (fixes #656)
9.5.4 #
9.5.3 #
9.5.2 #
Changed #
- All: Move
LocalStorePersistentStorageto isolate model to offload I/O operations, and unwindFuture.waitto loop
9.5.0 #
Added #
- Android: Introduce Android User Initiated Data Transfer (UIDT), triggered when task priority is set to 0 (max priority) on Android 14+, provided a notification is also configured. Explanation of Android execution options:
- WorkManager (default and preferred for most tasks): Used for most tasks. Subject to a 9-minute execution limit in the background. If the task is not finished within 9 minutes, it will be terminated (unless
allowPauseis true, in which case it will pause and resume). - Foreground Service: Triggered via
Config.runInForeground. Displays a persistent notification and is not subject to the 9-minute limit on many Android versions. RequiresFOREGROUND_SERVICE_DATA_SYNCpermission on Android 14+. - User Initiated Data Transfer (UIDT): Triggered by setting
priority: 0on Android 14+. This is a specialized JobScheduler mode that does not have the 9-minute limit and is designed for large, user-aware data transfers. It requires a notification to be shown.- Note: Using UIDT requires adding the
RUN_USER_INITIATED_JOBSpermission to yourAndroidManifest.xml, as well as a service declaration for.UIDTJobService. See the README for details.
- Note: Using UIDT requires adding the
- WorkManager (default and preferred for most tasks): Used for most tasks. Subject to a 9-minute execution limit in the background. If the task is not finished within 9 minutes, it will be terminated (unless
Changed #
- All: Replace sync with async I/O in
LocalStorePersistentStorageto prevent UI stutter - Android: Improvements for Android 14+ compatibility and Android 15 timeout logging
- Android: Update minimum Kotlin compiler version to 2.1.0
- iOS: Updates to
openFileand privacy manifest for iOS 16/17 compatibility
Fixed #
- Android: Fix
HoldingQueuelogic to correctly include UIDT jobs and prevent race conditions - Android: Properly capture WorkManager cancellations to ensure task status is updated to failed
Docs #
- Documentation refactor: break down README into separate files in
doc/directory
9.4.4 #
Changed #
- All: Performance improvements related to
Task.filePath,Task.splitandParallelDownloadTaskpause - Android: MinSDK is now 23 (was 21), required because the latest Android WorkManager is required to properly support Android 15+
Fixed #
- Android: Fix bug related to foreground service in Android 15+
9.4.3 #
9.4.2 #
9.4.1 #
Changed #
- All: Refine
TaskQueuepauseAll/resumeAllto support specific tasks and groups: updateTaskQueueinterface to accept optionaltasksandgroupparameters inpauseAllandresumeAll, and implement this forMemoryTaskQueue - All: Change platform checks from
Platform.isAndroidetc. todefaultTargetPlatform, which should lead to better tree shaking and smaller memory size
9.4.0 #
Added #
- All: Add
Config.skipExistingFilesconfiguration option to skip the download if the destination file already exists (and conditionally do this only for files greater than a certain size)
Changed #
- Android, iOS: Improve concurrency on mobile platforms by moving JSON encoding and decoding to an isolate, and introducing a job queue to ensure ordered message execution
9.3.0 #
Added #
- All: Add pause and resume functionality to
TaskQueueusingpauseAllandresumeAll. These methods are now called when pausing or resuming all tasks usingFileDownloader
Changed #
- Android: Change concurrency approach, triggered by the Great Thread Merge that causes UI blocking issues for recent versions of Flutter. Note this can cause minor changes in, for example, the sequence in which certain events happen.
Fixed #
- All: Fix issue with
MultiUploadTaskwhen uploading only one file - All: Make
UriUtilssubclasses private, as they should have been to start with - All: Address Dart analyzer recommendations
9.2.6 #
9.2.4 #
Fixed #
- All: Remove extraneous CR/LF after header in multipart upload
- Android: Use UTF-8 characters in
postfield - Android: Fallback for expedited tasks when encountering OS error
- Android: Fix
enqueAlland similar calls when no Activity is attached - iOS: Notification update after killed app resumes
9.2.3 #
9.2.2 #
Added #
- All: Add option to set the
Content-Dispositionheader for binary uploads. TheContent-Dispositionheader will be:- set to
'attachment = "filename"'if thetask.headersfield does not contain an entry for'Content-Disposition'(the prior default) - not set at all (i.e. omitted) if the
task.headersfield contains an entry for'Content-Disposition'with the value''(an empty string) - set to the value of
task.headers['Content-Disposition']in all other cases
- set to
Fixed #
- iOS: Fix bug when using
openFilewith a filepath containing spaces
9.2.0 #
9.1.1 #
9.1.0 #
9.0.0 #
Breaking Changes #
- All: Remove references to
asAndroidUri— use the new methods on theuriproperty instead
Added #
- All: Introduce URI operations, including file/photo/video/directory pickers, under the
uriproperty, andUriDownloadTaskandUriUploadTask(see Working with URIs):- URI operations abstract away platform differences, including content provider on Android (used for the Storage Access Framework), and file, photo and directory pickers on iOS and Android. This enables largely platform-independent code for file operations, and on Android downloads directly to destination, bypassing the temp file in internal storage.
- The
FileDownloader().uriproperty provides access to a set of utility functions for working with URIs, including:pickDirectory(): Opens a directory picker dialog and returns the selected directory's URI.pickFile(): Opens a file picker dialog and returns the selected file's URI.pickFiles(): Opens a file picker dialog and allows selection of multiple files, returning their URIs in a list.createDirectory(): Creates a new directory within a specified parent directory URI.getFileBytes(): Retrieves the file data (bytes) for a given URI.copyFile(): Copies a file from a source URI to a destination. Destination can be aUri, aFileor aStringcontaining a file path.moveFile(): Moves a file from a source URI to a destination. Destination can be aUri, aFileor aStringcontaining a file path. If the move fails, it is possible that the file was copied but the source was not deleted.deleteFile(): Deletes the file at the given URI.openFile(): Opens the file at a given URI.moveToSharedStorage(): Moves a file to a shared storage location.activate(): Activates a previously accessed directory or file. Only relevant if you usepersistedUriPermissionor use the photo/video picker.
- The
pick...methods andcreateDirectorytake an optionalpersistedUriPermissionargument (defaults tofalse) that whentrueregisters the picked directory with the OS, allowing access in a later session. - New/modified
Tasktypes:UriDownloadTask: Downloads a file to a specified directory URI. On Android, this bypasses the temp file used in the traditional approach and downloads directly to the destination.UriUploadTask: Uploads a file from a given file URI. If thefilenameis omitted, it will be based on the task's URL.MultiUploadTask: Now acceptsUriwhere previously only filename or file path was allowed.
- All: Add
enqueueAllto enqueue a list of tasks (non-blocking and with better performance when compared to callingenqueuefor each task) - All: Add native callback
beforeTaskStartCallbacktoTaskOptions, that is called just before the task starts executing. If it returns a non-nullTaskStatusUpdatethen this forces the task to finish before it starts, with thatTaskStatusUpdate - All: Add option to configure a
cancelednotification (instead of cancellation defaulting to theerrornotification)
Changed #
- iOS: Bump minimum iOS version to 14
Fixed #
- All: Fix bug with
requestwhen usingPUTorPATCHrequests - All: Fix bug for multi-part uploads when field values are formatted as a JSON string and contain non-ASCII characters
For earlier releases (v1.x – v8.x), see doc/CHANGELOG_ARCHIVE.md.