download_manager 1.0.1+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

download_manager #

Build Status

A package for automatically downloading and storing files

Getting Started #

Creating a DownloadableFile #

The first step is to create a downloadable file. The simplest way to do this is using a SimpleDownloadableFile

E.g. you can create one with a function (returning something can be written to file)

  File testFile = File("test_file.txt");
  var downloadFile = DownloadableFileBasic(() => "Test string", testFile);

You can also, optionally, set an expiry date time to your DownloadableFileBasic class. The purpose of this is to have a file which is only downloaded if the expiry date on the file is newer than the one you've already downloaded

Downloading a file #

Insert your downloadable file into the DownloadManager

DownloadManager.instance().add(DownloadableFileBasic(() => "Test string", testBFile));

Results in the stream

expectLater(DownloadManager.instance().fileStream, emits(testBFile));

Get notifications #

There are two streams (more in development) that you can subscribe to.

The first will return a stream which has files in fired one at a time as they are downloaded.


The second will return a list of all files downloaded. Note: files that are already downloaded will also be added to this list


You can also clear all files. You will be notified via allFiles stream with a new empty list that this has happened


[0.0.1] - 17/06/2019

  • Initial release

[1.0.0] - 18/06/2019

  • Addressing dart pub issues

[1.0.1] - 18/06/2019

  • Adding example
  • Adding clear
  • Adding ability to monitor all files downloaded in a list


example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  download_manager: ^1.0.1+2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:download_manager/download_manager.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.2


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
shared_preferences >=0.5.3 <0.6.0 0.5.5 0.5.6
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
shared_preferences_macos 0.0.1
shared_preferences_platform_interface 1.0.1
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
mockito ^4.0.0