https://github.com/anandhakrishnan-codeblock/downloader_flutter
A powerful Flutter download plugin supporting Android & iOS with real-time progress, parallel downloads, background safety, system DownloadManager integration, iOS URLSession delegate support.
https://github.com/anandhakrishnan-codeblock/downloader_flutter
android android-app background-worker download-manager downloader flutter flutter-plugin ios ios-app
Last synced: 5 months ago
JSON representation
A powerful Flutter download plugin supporting Android & iOS with real-time progress, parallel downloads, background safety, system DownloadManager integration, iOS URLSession delegate support.
- Host: GitHub
- URL: https://github.com/anandhakrishnan-codeblock/downloader_flutter
- Owner: Anandhakrishnan-CodeBlock
- License: apache-2.0
- Created: 2025-11-18T08:00:00.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-11-20T14:11:41.000Z (7 months ago)
- Last Synced: 2026-01-13T20:45:36.541Z (5 months ago)
- Topics: android, android-app, background-worker, download-manager, downloader, flutter, flutter-plugin, ios, ios-app
- Language: Dart
- Homepage: https://pub.dev/packages/downloader_flutter
- Size: 98 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Downloader Flutter
A powerful Flutter download plugin supporting Android & iOS with real-time progress, parallel downloads, background safety, system [DownloadManager](https://developer.android.com/reference/android/app/DownloadManager) integration, iOS [URLSessionDownloadDelegate](https://developer.apple.com/documentation/foundation/urlsessiondownloaddelegate) support, automatic file saving, Photos library export, and EventChannel-based streaming updates. Designed for handling large files with accurate progress tracking and smooth cross-platform performance.
Flutter Downloader Plugin
A full-featured, cross-platform file downloader built for Flutter, supporting Android & iOS with real-time progress, safe background execution, system-level integrations, and a clean EventChannel-driven update stream.
This plugin provides advanced download capabilities:
### Android Demo

### iOS Demo

# π Features
## Android Support
- Uses Android DownloadManager for reliable system-level downloading
- Supports parallel / multiple downloads simultaneously
- Real-time progress updates using EventChannel
- Safe background execution using coroutines (Dispatchers.IO)
- Automatic file handling and storage management
- Saves images/videos to Gallery when requested
- Toast feedback for start/error (optional)
- Thread-safe updates using Dispatchers.Main
- Kotlin implementation optimized for performance
## iOS Support
- Uses URLSessionDownloadDelegate for accurate progress tracking
- Supports true percentage (%) progress
- Parallel file downloads with per-file delegates
- Automatic movement of temporary downloaded files
- Optional save to Photos app
- Sends real-time events using Flutter EventChannel
- 100% main-thread safe event dispatching
- Swift implementation with clean status mapping
## Support
| Platform | Status |
|:--------:|:------:|
| Android | β
|
| iOS | β
|
| Windows | β |
| Linux | β |
| macOs | β |
# Plugin Configuration
## Android (Permission)
- Internet Permission Required
```
```
## iOS (Info.plist)
### 1. Photo Library Access (required)
> Because your code calls PHPhotoLibrary.requestAuthorization(...) and saves images/videos.
```
NSPhotoLibraryAddUsageDescription
This app saves downloaded media files to your Photos library.
NSPhotoLibraryUsageDescription
This app needs access to your Photos to save and view downloaded files.
```
### 2. App Transport Security (for HTTP downloads)
> If any of your download URLs use HTTP (not HTTPS), iOS will block them unless you add this:
- Option A β Allow only specific domains (recommended)
```
NSAppTransportSecurity
NSExceptionDomains
commondatastorage.googleapis.com
NSIncludesSubdomains
NSExceptionAllowsInsecureHTTPLoads
NSExceptionRequiresForwardSecrecy
```
- Option B β Allow all HTTP (for testing only)
```
NSAppTransportSecurity
NSAllowsArbitraryLoads
```
### 3. File Sharing (for βOn My iPhone β AppNameβ)
> To let users see downloaded files in the Files app:
```
UIFileSharingEnabled
LSSupportsOpeningDocumentsInPlace
```
### 4. Background downloads (optional but recommended)
> If you want downloads to continue when the app goes into the background:
```
UIBackgroundModes
fetch
processing
```
# Usage
- Object creation for DownloaderFlutter() class.
```
final _downloaderFlutterPlugin = DownloaderFlutter();
```
## Single file download
```
await _downloaderFlutterPlugin.downloadSingleFile(
url: 'https://images.pexels.com/photos/10725897/pexels-photo-10725897.jpeg',
fileName: "image.jpeg",
saveToPhoto: true, (Optional)
showToastAndroid: false, (Optional)
response: (data) {
debugPrint("Response In App: $data");
},
) ?? 'Downloader Not Connected';
```
#### Properties downloadSingleFile
| **Property** | **Type** | **Example Value** | **Description** |
|:---------------------|:--------:|:----------------------------:|:--------------------------------------------------------------------------|
| **url** | String | https://example.com/file.mp4 | The full download URL of the file. |
| **fileName** | String | my_video.mp4 | Name of the saved file, including its extension. |
| **saveToPhoto** | bool | true/false | iOS only β when true, saves downloaded media files to the Photos app. |
| **showToastAndroid** | bool | true/false | Android only β when true, shows a toast message after download completes. |
| **response** | String | "success" or "failed" | String response/status returned by the function. |
## Multiple file download
```
await _downloaderFlutterPlugin.downloadMultipleFile(
urls: [
'https://images.pexels.com/photos/177598/pexels-photo-177598.jpeg',
'https://images.pexels.com/photos/577585/pexels-photo-577585.jpeg',
'https://images.pexels.com/photos/1181244/pexels-photo-1181244.jpeg',
'https://images.pexels.com/photos/4816921/pexels-photo-4816921.jpeg',
'https://images.pexels.com/photos/248515/pexels-photo-248515.png',
],
fileNames: [
'image1.jpg',
'image2.jpg',
'image3.jpg',
'image4.jpg',
'image5.png',
],
saveToPhoto: true, (Optional)
showToastAndroid: true, (Optional)
response: (data) {
debugPrint("Response In App: $data");
},
) ?? 'Downloader Not Connected';
```
#### Properties downloadMultipleFile
| **Property** | **Type** | **Example Value** | **Description** |
|:---------------------|:------------:|:----------------------------------------------------------:|:--------------------------------------------------------------------------|
| **urls** | List | ["https://example.com/a.mp4", "https://example.com/b.jpg"] | The full download URL of the file. |
| **fileNames** | List | ["video1.mp4", "image1.jpg"] | Name of the saved file, including its extension. |
| **saveToPhoto** | bool | true/false | iOS only β when true, saves downloaded media files to the Photos app. |
| **showToastAndroid** | bool | true/false | Android only β when true, shows a toast message after download completes. |
| **response** | String | "success" or "failed" | String response/status returned by the function. |
## Event listener for downloadProgress
```
_downloaderFlutterPlugin.downloadProgress().listen((event) {
handleDownloadEvent(event);
});
```
## Download handler
```
void handleDownloadEvent(Map event) {
final status = event["status"] as String?;
if (status == null) {
debugPrint("β οΈ Unknown event: $event");
return;
}
final fileName = event["fileName"] as String? ?? "unknown";
switch (status) {
case "started":
debugPrint("π Started $fileName");
break;
case "progress":
final progress = event["progress"] as int? ?? 0;
debugPrint("π Progress $fileName: $progress%");
break;
case "success":
debugPrint("β
Completed $fileName");
break;
case "saved":
debugPrint("π· Saved to photo $fileName");
break;
case "failed":
debugPrint("β Failed $fileName");
break;
case "completed":
debugPrint("π Download completed $fileName");
break;
case "error":
final message = event["message"] as String? ?? "Unknown error";
debugPrint("β οΈ Error: $message");
break;
default:
debugPrint("β Unknown status: $status");
}
}
```
#### Properties handleDownloadEvent
| **Status Value** | **When Triggered** | **Meaning / Behavior** |
|:-----------------|:------------------------------------:|:-----------------------------------------------------------------:|
| **started** | When download begins | Indicates download has started for the given file. |
| **progress** | During active download | Provides incremental progress updates (0β100). |
| **success** | When file is successfully downloaded | File is saved locally in the device's documents directory. |
| **saved** | When file saved to Photos (iOS only) | Confirms that the media file has been added to the Photos app. |
| **failed** | When download fails | File couldnβt be downloaded due to error (e.g., network failure). |
| **completed** | When all download operations finish | Indicates full workflow completed (download + optional save). |
| **error** | When an internal error occurs | Provides an error message detailing what went wrong. |
# Bugs/Requests
Feel free to open an issue if you encounter any problems or think that the plugin is missing some feature.