Skip to content

alakreasi/flutter_android_downloader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Android Downloader

Pub

flutter_android_downloader 一个调用安卓系统下载管理器的插件

添加依赖

dependencies:
  flutter_android_downloader: ^1.0.0

创建下载

int downloadId = FlutterAndroidDownloader.download("url", "path", "fileName","originName","headers");

参数说明

参数 参数类型 说明
url String 下载地址
path String 下载路径,Android10及以上默认下载到内置存储目录的Download文件夹
fileName String 保存的文件名称
originName String 下载来源名称
headers Map<String,String> 请求头,参数可选

监听下载完成回调信息

FlutterAndroidDownloader.listen((id) {
  print("success $id");
  // to do something
});

完整使用示例

FlutterAndroidDownloader.listen((id) {
  print("success $id");
});

void download() async {
    int id = await FlutterAndroidDownloader.download(
        "https://qd.myapp.com/myapp/qqteam/AndroidQQ/mobileqq_android.apk",
        "/ABC",
        "qq.apk",
        "QQ",
        {}
    );
    print("ID => $id");
}

About

一个调用安卓系统下载管理器的flutter插件

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 64.5%
  • Dart 16.7%
  • Objective-C 12.1%
  • Ruby 6.7%