al_downloader

Creator: coderz1093

Last updated:

Add to Cart

Description:

al downloader

al_downloader #

A URL-based flutter downloader that supports to download any type of file and automatically manages a lot of things.
If you need Chinese Document, click here.
Features #

manage download tasks by url
simple download status
I/O infrequently
provide convenient download handle
support batch download
manage automatically files without requiring to be specified a download path
based on flutter_downloader

Integration #

Native Config: same as flutter_downloader native config

add the following line to your pubspec.yaml
dependencies:
al_downloader: ^1.8.4
copied to clipboard
run the following line with your command line
flutter packages get
copied to clipboard
import the following line, then you can use al_downloader
import 'package:al_downloader/al_downloader.dart';
copied to clipboard
Usage #
ALDownloader #
Initialize
ALDownloader.initialize();
copied to clipboard
Configure print
ALDownloader.configurePrint(true, frequentEnabled: false);
copied to clipboard
Download
ALDownloader.download(url,
directoryPath: directoryPath,
fileName: fileName,
handlerInterface:
ALDownloaderHandlerInterface(progressHandler: (progress) {
debugPrint(
'ALDownloader | download progress = $progress, url = $url\n');
}, succeededHandler: () {
debugPrint('ALDownloader | download succeeded, url = $url\n');
}, failedHandler: () {
debugPrint('ALDownloader | download failed, url = $url\n');
}, pausedHandler: () {
debugPrint('ALDownloader | download paused, url = $url\n');
}));
copied to clipboard
Add a handler interface
ALDownloader.addHandlerInterface(
ALDownloaderHandlerInterface(progressHandler: (progress) {
debugPrint(
'ALDownloader | download progress = $progress, url = $url\n');
}, succeededHandler: () {
debugPrint('ALDownloader | download succeeded, url = $url\n');
}, failedHandler: () {
debugPrint('ALDownloader | download failed, url = $url\n');
}, pausedHandler: () {
debugPrint('ALDownloader | download paused, url = $url\n');
}),
url);
copied to clipboard
Add a forever handler interface
ALDownloader.addForeverHandlerInterface(
ALDownloaderHandlerInterface(progressHandler: (progress) {
debugPrint(
'ALDownloader | download progress = $progress, url = $url\n');
}, succeededHandler: () {
debugPrint('ALDownloader | download succeeded, url = $url\n');
}, failedHandler: () {
debugPrint('ALDownloader | download failed, url = $url\n');
}, pausedHandler: () {
debugPrint('ALDownloader | download paused, url = $url\n');
}),
url);
copied to clipboard
Remove handler interface
ALDownloader.removeHandlerInterfaceForUrl(url);
copied to clipboard
Pause download
/// Stop download, but the incomplete data will not be deleted.
ALDownloader.pause(url);
copied to clipboard
Cancel download
/// Stop download, and the incomplete data will be deleted.
ALDownloader.cancel(url);
copied to clipboard
Remove download
/// Remove download, and all the data will be deleted.
ALDownloader.remove(url);
copied to clipboard
Get download status
final status = await ALDownloader.getStatusForUrl(url);
copied to clipboard
Get download progress
final progress = await ALDownloader.getProgressForUrl(url);
copied to clipboard
Get task
final task = await ALDownloader.getTaskForUrl(url);
copied to clipboard
Get all tasks
final tasks = await ALDownloader.tasks;
copied to clipboard
ALDownloaderBatcher #
Batch download
ALDownloaderBatcher.download(urls,
handlerInterface:
ALDownloaderHandlerInterface(progressHandler: (progress) {
debugPrint('ALDownloader | batch | download progress = $progress\n');
}, succeededHandler: () {
debugPrint('ALDownloader | batch | download succeeded\n');
}, failedHandler: () {
debugPrint('ALDownloader | batch | download failed\n');
}, pausedHandler: () {
debugPrint('ALDownloader | batch | download paused\n');
}));
copied to clipboard
Add a handler interface for batch
ALDownloaderBatcher.addHandlerInterface(
ALDownloaderHandlerInterface(progressHandler: (progress) {
debugPrint('ALDownloader | batch | download progress = $progress\n');
}, succeededHandler: () {
debugPrint('ALDownloader | batch | download succeeded\n');
}, failedHandler: () {
debugPrint('ALDownloader | batch | download failed\n');
}, pausedHandler: () {
debugPrint('ALDownloader | batch | download paused\n');
}),
urls);
copied to clipboard
Get download status for a set of urls
final status = await ALDownloaderBatcher.getStatusForUrls(urls);
copied to clipboard
Get tasks
final tasks = await ALDownloaderBatcher.getTasksForUrls(urls);
copied to clipboard
ALDownloaderFileManager - A manager that manages file by url #
final physicalFilePath =
await ALDownloaderFileManager.getPhysicalFilePathForUrl(url);
debugPrint(
'ALDownloader | get physical file path for [url], url = $url, path = $physicalFilePath\n');
copied to clipboard
Note: #
1. If the persistent file was removed by exceptional means, such as the cache folder being deleted by some business code, call [remove] and then call [download] to re-download for fixing the problem.
Key File Of Example #
iOS #

main.dart
AppDelegate.swift
Info.plist

Android #

main.dart
AndroidManifest.xml

Contributing #
Welcome contribution!
Welcome to open issue or PR for any problem, suggestion and idea!

Maintainer: jackleemeta (jackleemeta@outlook.com)

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.