A package for automatically downloading and storing files
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
Insert your downloadable file into the DownloadManager
DownloadManager.instance().add(DownloadableFileBasic(() => "Test string", testBFile));
Results in the stream
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
A new Flutter project.
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.
Add this to your package's pubspec.yaml file:
dependencies: download_manager: ^1.0.1+2
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.
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 Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
|Dart SDK||>=2.1.0 <3.0.0|