android_download_manager

This package lets you download files via Android Native Download Manager.

Getting Started

This package lets you download files via Android Native Download Manager. This package is made available only for android.

Permissions

  • WRITE_EXTERNAL_STORAGE
  • READ_EXTERNAL_STORAGE

How to download?

AndroidDownloadManager.enqueue(
    downloadUrl: "https://raw.githubusercontent.com/ableco/test-files/master/images/test-image-png_4032x3024.png",
    downloadPath: Directory.systemTemp.path,
    fileName: "test.png",
);
TypeDescription
downloadUrlStringThe url of the file to be downloaded
downloadPathStringThe location where the downloaded file to be saved
fileNameStringName of the downloaded file with extension
description (optional)StringDescription for the download manager
headers (optional)Map<String, String>Headers for the download url
allowScanningByMediaScanner (optional)boolWhether allow download manager to scan by MediaScanner
notificationVisibility (optional)NotificationVisibilityVISIBILITY_VISIBLE
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
NETWORK_MOBILE
NETWORK_WIFI
VISIBILITY_HIDDEN
VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION

Listen to completed downloads

AndroidDownloadManager.listen((data) {
    String id = data["id"];
    log("Download complete");
  });

Here we receive IDs of the completed downloads.

Libraries

android_download_manager