al_downloader 1.0.7 copy "al_downloader: ^1.0.7" to clipboard
al_downloader: ^1.0.7 copied to clipboard

outdated

A URL-based flutter downloader that supports to download any type of file and automatically manages a lot of things.

al_downloader #

pub package

A URL-based flutter downloader that supports to download any type of file and automatically manages a lot of things.

Features #

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

Installing #

add the line to your pubspec.yaml

dependencies:
  al_downloader: ^1.0.7

run the line with your commmand line

flutter packages get

import the line, then you can use al_downlaoder

import 'package:al_downloader/al_downloader.dart';

Usage #

ALDownloader #

/// download
ALDownloader.download(url,
    downloaderHandlerInterface:
        ALDownloaderHandlerInterface(progressHandler: (progress) {
      debugPrint(
          "ALDownloader | downloading, the url = $url, progress = $progress");
    }, successHandler: () {
      debugPrint("ALDownloader | download successfully, the url = $url");
    }, failureHandler: () {
      debugPrint("ALDownloader | download failed, the url = $url");
    }, pausedHandler: () {
      debugPrint("ALDownloader | download paused, the url = $url");
    }));
/// add a download handle interface
ALDownloader.addALDownloaderHandlerInterface(
    ALDownloaderHandlerInterface(progressHandler: (progress) {
      debugPrint(
              "ALDownloader | downloading, the url = $url, progress = $progress");
    }, successHandler: () {
      debugPrint("ALDownloader | download successfully, the url = $url");
    }, failureHandler: () {
      debugPrint("ALDownloader | download failed, the url = $url");
    }, pausedHandler: () {
      debugPrint("ALDownloader | download paused, the url = $url");
    }),
    url);
/// remove a download handle interface
ALDownloader.removeALDownloaderHandlerInterfaceForUrl(url);
ALDownloader.removeALDownloaderHandlerInterfaceForAll;
/// get the download status of [url]
ALDownloaderStatus status = ALDownloader.getDownloadStatusForUrl(url);
/// cancel
///
/// for details, see interface description
ALDownloader.cancel(url);
ALDownloader.cancelAll;
/// pause
///
/// for details, see interface description
ALDownloader.pause(url);
ALDownloader.pauseAll;
/// remove
///
/// for details, see interface description
ALDownloader.remove(url);
ALDownloader.removeAll;

ALDownloaderBatcher #

/// batch downlaod
ALDownloaderBatcher.downloadUrls(kTestVideos,
    downloaderHandlerInterface:
        ALDownloaderHandlerInterface(progressHandler: (progress) {
      debugPrint("ALDownloader | downloading, progress = $progress");
    }, successHandler: () {
      debugPrint("ALDownloader | download successfully");
    }, failureHandler: () {
      debugPrint("ALDownloader | download failed");
    }, pausedHandler: () {
      debugPrint("ALDownloader | download paused");
    }));
/// summarize the download status of a set of urls
final status = ALDownloader.getDownloadStatusForUrls(urls);

ALDownloaderPersistentFileManager - disk path management by url #

final model = await ALDownloaderPersistentFileManager
    .lazyGetALDownloaderPathModelFromUrl(url);
debugPrint(
    "ALDownloader | get the 'physical directory path' and 'vitual/physical file name' of the file by [url], url = $url, path model = $model\n");

final path2 = await ALDownloaderPersistentFileManager
    .getAbsolutePathOfDirectoryWithUrl(url);
debugPrint(
    "ALDownloader | get 'directory path' by [url], url = $url, path = $path2\n");

final path3 = await ALDownloaderPersistentFileManager
    .getAbsoluteVirtualPathOfFileWithUrl(url);
debugPrint(
    "ALDownloader | get 'virtual file path' by [url], url = $url, path = $path3\n");

final path4 = await ALDownloaderPersistentFileManager
    .getAbsolutePhysicalPathOfFileWithUrl(url);
debugPrint(
    "ALDownloader | get 'physical file path' by [url], url = $url, path = $path4\n");

final isExist = await ALDownloaderPersistentFileManager
    .isExistAbsolutePhysicalPathOfFileForUrl(url);
debugPrint(
    "ALDownloader | check whether [url] corresponds to physical path, url = $url, is Exist = $isExist\n");

final fileName = ALDownloaderPersistentFileManager.getFileNameFromUrl(url);
debugPrint(
    "ALDownloader | get virtual/physical 'file name' by [url], url = $url, file name = $fileName\n");

Native Config #

Demo For iOS #

Maintainer: jackleemeta (jackleemeta@outlook.com)

102
likes
0
pub points
87%
popularity

Publisher

unverified uploader

A URL-based flutter downloader that supports to download any type of file and automatically manages a lot of things.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

convert, crypto, flutter, flutter_downloader, path_provider, uuid

More

Packages that depend on al_downloader