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
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
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:
dependencies: download_manager: ^1.0.1+2
2. Install it
You can install packages from the command line:
$ 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:
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]
We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.5.1
- pana: 0.12.21
- Flutter: 1.9.1+hotfix.4
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.