Skip to main content

background_downloader 9.7.1 copy "background_downloader: ^9.7.1" to clipboard
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-Dart HEAD offset 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 via onTaskStart / Auth
    • Google Cloud Storage (GCS) Resumable via package:background_downloader/gcs.dart (GcsUploadTask, registerGcsLogicalTaskHandler) with pure-Dart 308 Resume Incomplete and Range chunk acknowledgement handling
  • All: Add taskIdsToResume to LogicalTaskResponse so LogicalTaskHandler implementations can resume specific paused sub-tasks by ID across Android, iOS, and Desktop

Changed #

  • All: Standardize on Transfers.getOrStartAll and deprecate Transfers.startOrGetAll
  • Android: Update GroupNotification progress bar and {progress} token continuously while tasks are running (throttled to at most once per second and whole-percent changes), and guard showsProgress on a non-null running notification config (refs #768)

Fixed #

  • Desktop: Preserve Range header across binary upload retries by stripping it only from outgoing HTTP request headers instead of mutating task.headers in place
  • iOS: Clear per-task state dictionaries (including tasksWithModifications) on final LogicalTask sub-task status updates before returning early into LogicalTaskManager, preventing stale modified tasks from triggering infinite native retry loops

Docs #

  • Reorganize doc/logical_tasks.md around concepts, custom handlers, bundled protocols (HLS, MPEG-DASH, TUS, S3, GCS), and CallbackTask, surface supported protocols in README.md, and update doc/uploads.md, doc/lifecycle.md, doc/CONFIG.md, doc/transfers.md, doc/notifications.md, and doc/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 startAfterTaskIds tasks have finished, potentially with a TaskStatus condition defined in startAfterRequires. These are great for running tasks in a specific order, with conditions (e.g. for a clean-up after all downloads succeeded)

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 automatic TaskStatus.enqueued → TaskStatus.running transitions, per-task persisted JSON state, scratch working directories, weighted progress aggregation, and automatic native sub-task retries
    • Opt-in HLS (.m3u8) support via package:background_downloader/hls.dart (HlsDownloadTask, registerHlsLogicalTaskHandler): VOD master/media playlists, variant selection, #EXT-X-KEY/#EXT-X-MAP/#EXT-X-BYTERANGE, and localPlaylist/stitchSegments output modes
    • Opt-in MPEG-DASH (.mpd) support via package:background_downloader/dash.dart (DashDownloadTask, registerDashLogicalTaskHandler): SegmentTemplate/SegmentTimeline/SegmentList/SegmentBase, multi-track video+audio selection, and localManifest/stitchSegments output 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 via TaskStatusUpdate.responseBody / transfer.result
  • All: Add Scheduled Tasks via TaskOptions.earliestStartTime for best-effort "not before" deferred execution of DownloadTask, UploadTask, DataTask, LogicalTask, and CallbackTask:
    • Android: Persisted in NativeStore and triggered by a WorkManager delayed ScheduledTaskWorker (survives app termination and reboots)
    • iOS: Persisted in NativeStore and scheduled via URLSessionTask.earliestBeginDate (using a zero-byte canceled sentinel URLSessionDownloadTask for LogicalTask wake-ups)
    • Desktop: Scheduled with an in-process Dart Timer while the app process is running
    • Full integration with allTasks, taskForId, cancel, reset, pause/resume, and HoldingQueue
  • All: Add Dependent / Chained Tasks via TaskOptions.startAfterTaskIds and TaskOptions.startAfterRequires (also exposed directly on CallbackTask.create):
    • Support multi-task fan-in, fan-out, and chaining (wait for all listed taskIds to finish: TaskStatus.complete requires all to complete, null accepts any final outcome, and failed/notFound/canceled waits for all to finish and runs if any matched), composable with TaskOptions.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() with false
    • Cancel waiting dependent tasks automatically when startAfterRequires is not satisfied (cascading downstream on TaskStatus.complete failure) and purge stale >24h dependent tasks every 100 store accesses
    • Full integration across Android, iOS, and Desktop (allTasks, taskForId, cancel, reset, pause/resume, HoldingQueue, and NativeStore)
  • Example: Add live HLS (HlsDownloadTask) download workflow, 1-minute scheduled CallbackTask workflow, and multi-task dependent/chained workflow (Step 1A + Step 1B → Step 2) to example/lib/main.dart

Changed #

  • Android, iOS: Replace legacy SharedPreferences/UserDefaults task storage with a unified, WAL-mode SQLite NativeStore (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 HoldingQueue onto persistent SQLite NativeStore storage and fix queue concurrency and lifecycle bugs
  • Android, iOS: Move task retry orchestration to native (NativeRetry backed by WorkManager on Android and URLSessionTask.earliestBeginDate on 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 TransferProgressBar horizontal overflow, stop indeterminate progress animation on canceled/failed/notFound transfers, add TransferListTile.contentPadding, align all TransferButton trailing icons consistently, standardize failed/notFound/canceled retry icons on Icons.refresh, and add showRetryButton (default true) on TransferButton and TransferListTile

Docs #

  • Add doc/logical_tasks.md covering LogicalTask, HLS, MPEG-DASH, and CallbackTask, and document TaskOptions.earliestStartTime and startAfterTaskIds / startAfterRequires in doc/lifecycle.md, doc/topic_index.md, and README.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 openFile with non-shell invocation

Changed #

  • iOS: Declare DiskSpace and FileTimestamp API reasons in PrivacyInfo.xcprivacy
  • Desktop: Apply requestTimeout to upload response wait rather than total upload duration

Fixed #

  • All: Fix deadlocks in Transfer.allowCellular/resume, duplicate/clobbered updates in Transfers, stall watchdog scoping, and pause-before-resume synchronization
  • All: Scope FileDownloader.scoped namespaces consistently across rescheduleKilledTasks, trackTasks, pauseAll, resumeAll, and notification configs; fix all-group cancelAll/pauseAll
  • All: Lazily initialize Transfers, handle failed/batch enqueues cleanly, preserve expectedFileSize in DB, complete awaitTasks/canResumeTask on reset, and fix DownloadProgressIndicator state/rebuild bugs
  • All: Fix TransferHint.allowPause on non-GET tasks, balance ParallelDownloadTask chunk ranges/validation, fix MultiUploadTask duplicate file multipart terminator loops, fix MemoryTaskQueue.reset(group:) and enqueue rollback, and fix Localstore 0-byte reads, cache evictions, and isolate lifecycle
  • Desktop: Fix race reporting 200 OK uploads as failed, free slots on beforeTaskStart, await async onTaskFinished, fix ParallelDownloadTask stitching/cancel races, and catch isolate/mTLS client creation errors cleanly
  • Android: Harden TaskWorker/UIDTJobService foreground exceptions, notification config/channel guards, HoldingQueue API 23 locking, TaskRunner cancel/disconnect races, BDPlugin lifecycle and QueueService ordering, ParallelDownloadTaskRunner/UploadTaskRunner synchronization and cleanup, UriUtils I/O offloading and fallbacks, and UIDT notification finalization (refs #753)
  • iOS: Merge notification categories instead of overwriting other plugins, run Callbacks on main thread, harden UrlSessionDelegate/HoldingQueue/WiFiQueue concurrency, move ParallelDownloader chunk stitching off main thread and align pause/resume lifecycle with Android/Desktop, persist temp upload cleanup, close Uploader file handles, and fix UriUtils/OpenFile security-scoped access, Range parsing, TaskException decoding, and case-insensitive Content-Type extraction

Docs #

  • Fix platform accuracy notes, broken code snippets, Dartdocs, and broken markdown links/anchors across README.md and doc/

9.6.7 #

Changed #

  • All: Migrate from deprecated Flutter material.dart/cupertino.dart imports to material_ui and cupertino_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 UIScene lifecycle

Fixed #

  • All: Guard non-positive, non-finite, and overflowing timeRemaining in 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.root in FileDownloader.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 numFailed in GroupNotification groupState
  • iOS: Compare Task equality and hash by taskId only (#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.6 #

Fixed #

  • All: Bug fixes

9.6.5 #

Fixed #

  • All: Bug fixes

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:monitor from implementation dependencies

Fixed #

  • iOS: Fix group notification completion cleanup when notification is unconfigured: ensure GroupNotification registry cleanup is executed upon group completion regardless of whether error or complete notification 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 Transfers callbacks from user-registered callbacks using dedicated groupTransfer callback maps in BaseDownloader, preventing internal callbacks from suppressing events on FileDownloader().updates, and preserving callback reference equality in registerCallbacks/unregisterCallbacks (fixes #727)
  • Android: Fix Kotlin compiler warnings: align serializer visibility with public enums in Models.kt, remove unnecessary safe calls in UIDTJobService.kt, and streamline UriUtils.kt

9.6.1 #

Added #

  • iOS: Add optional static closures BDPlugin.onNativeTaskStatusChange and BDPlugin.onNativeTaskProgressChange on BDPlugin to 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_plus version constraint to >=6.1.3 <8.0.0 to support connectivity_plus 7.x (fixes #722)
  • Android: Enforce Wi-Fi constraint via NetworkRequest on Android API 28+: require TRANSPORT_WIFI and NET_CAPABILITY_INTERNET for tasks requiring Wi-Fi, preventing downloads over cellular even when reported as unmetered by the carrier, with fallback to NETWORK_TYPE_UNMETERED on older Android versions (fixes #717)
  • iOS: Partial upload slicing optimization: use FileHandle.seek(toOffset:) instead of reading and discarding leading bytes in createTempFileWithRange, 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 requiresWiFi behavior on Android API 28+ vs earlier Android versions

9.6.0 #

Added #

  • All: Introduce the transfers object and Transfer API — a major new high-level reactive abstraction for managing background downloads, uploads, and data tasks via FileDownloader().transfers:
    • Dedicated transfer manager: accessed via FileDownloader().transfers (Transfers class), providing methods to start, batch start, reconnect to, and query background transfers
    • First-class Transfer handle returned by transfers.start, startAll, getOrStart, and startOrGetAll
    • Automatic status update promotion: tasks enqueued through transfers are automatically ensured to provide status updates (Updates.statusAndProgress or Updates.status) for reliable lifecycle tracking
    • Database persistence & rehydration: getOrStart and startOrGetAll re-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 completed File, dynamically tracking server-suggested filenames if renamed upon completion), transfer.result (resolves to final TaskStatusUpdate), and transfer.responseBody
    • Reactive ValueNotifier properties for Flutter UI: statusNotifier, progressNotifier (normalized 0.0–1.0), networkSpeedNotifier (MB/s), timeRemainingNotifier, holdReasonNotifier, exceptionNotifier, and notificationTapNotifier
    • Direct action controls on the handle: pause(), resume(), cancel(), and allowCellular()
    • Robust resumption & retries: resume() and allowCellular() 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 TransferHint presets (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 optional onCancel callback), and TransferListTile
    • Transfer collections and reactive notifications: transfers.notifier (ValueNotifier<List<Transfer>>), transfers.all(), active(), completed(), failed(), forId(), forTask(), and forUrl()
    • Lifecycle management and cleanup: transfers.remove(), removeById(), cancelAll(), and clear({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 configurable stallTimeout watchdog
    • Dedicated documentation in doc/transfers.md and overhauled example app demonstrating Transfer best practices
  • Tests: Add device selection options (-d/--device, --ios, --android, --macos) and --dry-run flag to run_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.0 and 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_lints to ^6.0.0 with updated analysis options
  • 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 enable onlyAlertOnce, 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.buildconfig property from example app gradle.properties (closes #674 / AGP 9 compatibility)
  • iOS: Modernize Swift Package Manager (SwiftPM) support: add required FlutterFramework dependency in Package.swift, expand permissions bypass documentation for SwiftPM, and transition example app (ios and macos) 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, and general_test.dart

Fixed #

  • Android: Apply readTimeout matching requestTimeout on HttpURLConnection and properly classify SocketTimeoutException as a connection exception, preventing tasks from blocking indefinitely when waiting for response headers
  • iOS: Fix group notification dismissal: use groupNotification.notificationId rather than task.taskId in updateGroupNotification to properly dismiss group notifications (fixes #718)
  • iOS: Fix notification category for group notifications: explicitly assign .runningWithoutPause, .complete, or .error category so UNUserNotificationCenterDelegate.willPresent recognizes and delivers running and finished group notifications (fixes #718)
  • Desktop: Apply requestTimeout to client.send(request) in doDownloadTask and doDataTask, and to head in doParallelDownloadTask, preventing tasks from hanging indefinitely in running status if the network drops or the server stalls while waiting for response headers (fixes #721)

Docs #

  • Clarify requireWiFi platform 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_JOBS requirement
  • Android, Desktop: Document Config.tempFilePath for 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.tempFilePath to allow configuring a custom temporary directory path for downloads (closes #712)
  • Desktop: Add Config.mTLS and MTLSConfig data 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 HoldingQueue and batch-drain available concurrency slots
  • Android: Eliminate deadlock risk in WiFi requirement lock with watchdog timeout
  • Android: Resolve coroutine hang in Callbacks when callback handle is missing or invalid
  • Android: Add copy+delete fallback for cross-device moves in DownloadTaskRunner
  • Android: Prevent InputStream resource leaks in UploadTaskRunner
  • Android: Delete incomplete MediaStore entry upon moveToSharedStorage failure
  • Android: Clean up partial multipart file if creation fails in UploadTaskRunner
  • iOS: Prevent stateLock contention during network I/O in HoldingQueue and batch-drain concurrency slots
  • iOS: Prevent pauseSingleTask race 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.updates stream (fixes #708)

9.5.8 #

Added #

  • All: Add alsoRestartUploads parameter to FileDownloader.requireWiFi to optionally cancel and restart running upload tasks when updating WiFi requirement (fixes #695)

Fixed #

  • iOS: Fix typo in PrivacyInfo.xcprivacy for photos and videos data collection key (NSPrivacyCollectedDataTypePhotosorVideos), resolving App Store submission validation errors (fixes #694)

Docs #

  • Add comprehensive documentation for TaskStatusUpdate and TaskProgressUpdate in doc/status_updates.md (fixes #684)

9.5.7 #

Fixed #

  • All: Defer JsonProcessor idle 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 ConcurrentModificationException in canSendCancellation when 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_ACCESS race condition under concurrent status updates

9.5.6 #

Changed #

  • Android: Add fallback to legacy kotlin-android plugin in Gradle build if builtInKotlin is configured to false (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 FlutterFramework dependency path in Package.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 #

Added #

  • All: Add TaskOptions to DataTask with similar functionality as in DownloadTask

Fixed #

  • All: Bug fixes

9.5.3 #

Fixed #

  • Android: Fix race condition in TaskWorker where setForeground could crash for finished tasks

Docs #

  • Add documentation
  • Add integration testing documentation and steps

9.5.2 #

Changed #

  • All: Move LocalStorePersistentStorage to isolate model to offload I/O operations, and unwind Future.wait to loop

9.5.1 #

Added #

  • iOS: Support for UISceneDelegate in iOS 13.0 and above

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 allowPause is 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. Requires FOREGROUND_SERVICE_DATA_SYNC permission on Android 14+.
    • User Initiated Data Transfer (UIDT): Triggered by setting priority: 0 on 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_JOBS permission to your AndroidManifest.xml, as well as a service declaration for .UIDTJobService. See the README for details.

Changed #

  • All: Replace sync with async I/O in LocalStorePersistentStorage to 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 openFile and privacy manifest for iOS 16/17 compatibility

Fixed #

  • Android: Fix HoldingQueue logic 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.split and ParallelDownloadTask pause
  • 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 #

Added #

  • All: Add database.cleanUp() to simplify and automate database maintenance, and add database clean-up to start() command

Changed #

  • All: Improve JSON processing to reduce UI jank
  • All: Optimize database operations

Fixed #

  • iOS: Fix background callback performance

9.4.2 #

Added #

  • Tests: Add local test server to reduce test suite flakiness

Changed #

  • Android: Improve notification handling

Docs #

  • Improve code documentation

9.4.1 #

Changed #

  • All: Refine TaskQueue pauseAll/resumeAll to support specific tasks and groups: update TaskQueue interface to accept optional tasks and group parameters in pauseAll and resumeAll, and implement this for MemoryTaskQueue
  • All: Change platform checks from Platform.isAndroid etc. to defaultTargetPlatform, which should lead to better tree shaking and smaller memory size

9.4.0 #

Added #

  • All: Add Config.skipExistingFiles configuration 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 TaskQueue using pauseAll and resumeAll. These methods are now called when pausing or resuming all tasks using FileDownloader

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 MultiUploadTask when uploading only one file
  • All: Make UriUtils subclasses private, as they should have been to start with
  • All: Address Dart analyzer recommendations

9.2.6 #

Changed #

  • Android: compileSDK set to 36, targetSDK for example app set to 36, Kotlin compiler in example app set to 2.1.0

Fixed #

  • Android: Fix Tap to open (on notification) bug, introduced in 9.2.4

9.2.5 #

Fixed #

  • iOS: Catch file write errors in multi-part uploads
  • iOS: Fix optional unwrap error

9.2.4 #

Fixed #

  • All: Remove extraneous CR/LF after header in multipart upload
  • Android: Use UTF-8 characters in post field
  • Android: Fallback for expedited tasks when encountering OS error
  • Android: Fix enqueAll and similar calls when no Activity is attached
  • iOS: Notification update after killed app resumes

9.2.3 #

Changed #

  • iOS: Improved permissions bypassing

Fixed #

  • Android: Unmark temp files as cache after move to download destination
  • Android: Support $ sign in notification substitutions
  • iOS: Fix crash on returning app to foreground when app is suspended

9.2.2 #

Added #

  • All: Add option to set the Content-Disposition header for binary uploads. The Content-Disposition header will be:
    • set to 'attachment = "filename"' if the task.headers field does not contain an entry for 'Content-Disposition' (the prior default)
    • not set at all (i.e. omitted) if the task.headers field 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

Fixed #

  • iOS: Fix bug when using openFile with a filepath containing spaces

9.2.1 #

Fixed #

  • All: Minor bug fixes

9.2.0 #

Added #

  • All: Add updates broadcast stream to the database property, which emits every TaskRecord update made to the database

Fixed #

  • All: Fix issue with start and rescheduleKilledTasks when using group names for tasks
  • All: Minor bug fixes and enhancements

9.1.1 #

Added #

  • All: Add optional group parameter to resumeAll

Fixed #

  • Android: Fix concurrency bugs

9.1.0 #

Added #

  • All: Add pauseAll, cancelAll and resumeAll

Changed #

  • All: Improve handling of enqueuAll to not starve the UI thread

Fixed #

  • iOS: Fix compilation bug when compiling with Xcode 16.2

9.0.0 #

Breaking Changes #

  • All: Remove references to asAndroidUri — use the new methods on the uri property instead

Added #

  • All: Introduce URI operations, including file/photo/video/directory pickers, under the uri property, and UriDownloadTask and UriUploadTask (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().uri property 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 a Uri, a File or a String containing a file path.
      • moveFile(): Moves a file from a source URI to a destination. Destination can be a Uri, a File or a String containing 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 use persistedUriPermission or use the photo/video picker.
    • The pick... methods and createDirectory take an optional persistedUriPermission argument (defaults to false) that when true registers the picked directory with the OS, allowing access in a later session.
    • New/modified Task types:
      • 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 the filename is omitted, it will be based on the task's URL.
      • MultiUploadTask: Now accepts Uri where previously only filename or file path was allowed.
  • All: Add enqueueAll to enqueue a list of tasks (non-blocking and with better performance when compared to calling enqueue for each task)
  • All: Add native callback beforeTaskStartCallback to TaskOptions, that is called just before the task starts executing. If it returns a non-null TaskStatusUpdate then this forces the task to finish before it starts, with that TaskStatusUpdate
  • All: Add option to configure a canceled notification (instead of cancellation defaulting to the error notification)

Changed #

  • iOS: Bump minimum iOS version to 14

Fixed #

  • All: Fix bug with request when using PUT or PATCH requests
  • 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.

510
likes
160
points
360k
downloads

Documentation

API reference

Publisher

verified publisherbbflight.com

Weekly Downloads

A multi-platform background file downloader and uploader. Define the task, enqueue and monitor progress

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com

License

BSD-3-Clause, MIT (license)

Dependencies

async, collection, connectivity_plus, flutter, http, logging, material_ui, mime, path, path_provider

More

Packages that depend on background_downloader

Packages that implement background_downloader