easy_downloader 0.0.14-dev easy_downloader: ^0.0.14-dev copied to clipboard
Easy Downloader is a simple and easy to use plugin to download files from the internet.
Fast download manager allow download in multiple isolate, file is split to multiple segments and download each segment using different connections.
Features #
- ✅ Support resume, pause, download
- ✅ Support queue download
- ✅ Download with multiple connections in multiple isolate with progress
- ✅ Support notification
- ✅ Support open file after download (only android and ios)
Getting started #
add easy_downloader into your pubspec.yaml.
dependencies:
easy_downloader: ^0.0.1-dev.1
Usage #
- Initialize the plugin
await EasyDownloader.init(startQueue: true, maxConcurrentTasks: 4);
- Create new task
var url = "http://speedtest.ftp.otenet.gr/files/test10Mb.db";
var name = "test10MB";
var path = (await getApplicationDocumentsDirectory()).path;
var task = await EasyDownloader.newTask(url, path, name, maxSplit: 8, showNotification: true);
- add task in queue
//queue will automatically start
EasyDownloader.addTaskQueue(task.downloadId);
- listen with speed/s and progress
var controller = EasyDownloader.getController(task.downloadId);
if (controller != null){
controller.start(monitor: DownloadMonitor(
duration: const Duration(milliseconds: 100),
blockMonitor: (blocks){
//listen all blocks
},
onProgress: (downloaded, total, speed, status) {
//listen progress
//listen speed/second
//listen status
//listen status
},
));
}
else{
//no task found
}
- listen download directly in widget
EasyDownloadTaskListenable(task.downloadId, (context, task, controller) {});
Additional information #
-
only tested on android
-
sometime your downloaded length will exceed the total length, it is not problem, this problem occurs if your file is small
License #
MIT License
Copyright (c) 2022 linkkader
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.