downloadable 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

downloadable #

Downloadable is a file that might be in internal storage or still not downloaded.

how to crate a downloadable

var downloadable = Downloadable(
  downloadLink: 'www.example.com/files/downloadable.file',
  fileAddress: tempFolder + '/files/downloadable.file',
); 

check if its downloaded


var downloaded = await downloadable.downloaded;

start a download

if(
!downloaded){

var onDownloadComplete = (){
    print('download complete!');  
  };
  
  var progressStream = downloadable.download(onDownloadComplete);
  
  progressStream.listen((p){
    print('${p*100}%...');
  });
  
}

Cancel a download

downloadable.cancel();

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/main.dart

import 'package:downloadable/downloadable.dart';

main() async {
  var tempFolder = '';

  var downloadable = Downloadable(
    downloadLink: 'www.example.com/files/downloadable.file',
    fileAddress: tempFolder + '/files/downloadable.file',
  );

  var downloaded = await downloadable.downloaded;

  if (!downloaded) {
    var onDownloadComplete = () {
      print('download complete!');
    };

    var progressStream = downloadable.download(onDownloadComplete);

    progressStream.listen((p) {
      print('${p * 100}%...');
    });
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  downloadable: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:downloadable/downloadable.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:downloadable/downloadable.dartpackage:downloadable/src/downloadable.dartdart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:downloadable/downloadable.dartpackage:downloadable/src/downloadable.dartdart:io

Health issues and suggestions

Document public APIs. (-1 points)

13 out of 13 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^3.0.8 3.0.9
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
http_parser 3.1.4
meta 1.2.2 1.3.0-nullsafety
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety