Last updated:
0 purchases
flutter android downloader
Flutter Android Downloader #
flutter_android_downloader 一个调用安卓系统下载管理器的插件
添加依赖 #
dependencies:
flutter_android_downloader: ^1.0.0
copied to clipboard
创建下载 #
int downloadId = FlutterAndroidDownloader.download("url", "path", "fileName","originName","headers");
copied to clipboard
参数说明
参数
参数类型
说明
url
String
下载地址
path
String
下载路径,Android10及以上默认下载到内置存储目录的Download文件夹
fileName
String
保存的文件名称
originName
String
下载来源名称
headers
Map<String,String>
请求头,参数可选
监听下载完成回调信息 #
FlutterAndroidDownloader.listen((id) {
print("success $id");
// to do something
});
copied to clipboard
完整使用示例 #
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");
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.