- Android这一侧的下载依赖AppUpdate库
- 添加依赖 pub versions
dependencies:
flutter_app_update: ^latest_version
- 创建
UpdateModel
设置下载地址
UpdateModel model = UpdateModel(
url,
"flutterUpdate.apk",
/// android res/mipmap 目录下的图片名称
"ic_launcher",
'https://itunes.apple.com/cn/app/抖音/id1142110895',
);
AzhonAppUpdate.update(model).then((value) => debugPrint('$value'));
- 监听下载过程
@override
void initState() {
super.initState();
AzhonAppUpdate.listener((ResultModel model) {
debugPrint('$model');
});
}