Search packages, repositories and app categories

Package detailsv1.8.4

al_downloader

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

AndroidiOS
30-day downloads
333
Likes
104
Pub points
120

Install package

flutter pub add al_downloader

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

al_downloader is a Flutter package that enables URL-based file downloading across Android and iOS platforms. It supports downloading any file type and automatically handles common tasks like managing download queues, tracking progress, and managing storage permissions. The package simplifies the implementation of robust download functionality within Flutter apps, making it ideal for applications requiring reliable background downloads. With minimal setup via pub add, developers can integrate powerful download capabilities with ease.

Use cases

  • Downloading files from URLs
  • Background file downloads
  • Handling large file transfers
  • Managing download progress
  • Automated download queue management

Key features

  • Supports all file types
  • Automatic download management
  • Cross-platform (Android & iOS)
  • Progress tracking
  • Background download support

Suitable for

  • Apps needing file downloads
  • Media content delivery
  • Offline data caching
  • Educational or productivity apps
  • Applications with large asset libraries

Considerations

  • Requires internet permission on Android
  • May need background execution permissions on iOS
  • Large files require careful memory management
  • File path handling may vary by platform
  • No built-in resume capability mentioned

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

al_downloader

pub package

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

run the following line with your command line

flutter packages get

import the following line, then you can use al_downloader

import 'package:al_downloader/al_downloader.dart';

Usage

ALDownloader
Initialize
ALDownloader.initialize();
Configure print
ALDownloader.configurePrint(true, frequentEnabled: false);
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');
    }));
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);
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);
Remove handler interface
ALDownloader.removeHandlerInterfaceForUrl(url);
Pause download
/// Stop download, but the incomplete data will not be deleted.
ALDownloader.pause(url);
Cancel download
/// Stop download, and the incomplete data will be deleted.
ALDownloader.cancel(url);
Remove download
/// Remove download, and all the data will be deleted.
ALDownloader.remove(url);
Get download status
final status = await ALDownloader.getStatusForUrl(url);
Get download progress
final progress = await ALDownloader.getProgressForUrl(url);
Get task
final task = await ALDownloader.getTaskForUrl(url);
Get all tasks
final tasks = await ALDownloader.tasks;
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');
    }));
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);
Get download status for a set of urls
final status = await ALDownloaderBatcher.getStatusForUrls(urls);
Get tasks
final tasks = await ALDownloaderBatcher.getTasksForUrls(urls);
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');

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
Android

Contributing

Welcome contribution!

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

Maintainer: jackleemeta (jackleemeta@outlook.com)

Categories

Dependencies

Dependency list 7 items

Source repository

Projects using this package

No data available yet.