flutter_app_update 3.1.0 flutter_app_update: ^3.1.0 copied to clipboard
A simple lightweight and customizable version update library for Flutter
Chinese Doc #
一、Introduce #
- Android update use AppUpdate library
- Add to pubspec.yaml pub versions
dependencies:
flutter_app_update: ^latest_version
- Create
UpdateModel
and set apk url
UpdateModel model = UpdateModel(
url,
"flutterUpdate.apk",
/// android res/mipmap icon name
"ic_launcher",
'https://itunes.apple.com/cn/app/xxxx',
);
AzhonAppUpdate.update(model).then((value) => debugPrint('$value'));
- Listener download
@override
void initState() {
super.initState();
AzhonAppUpdate.listener((map) {
debugPrint('app update listener: ${jsonEncode(map)}');
});
}
Type | Keys | Type of data | Remark |
---|---|---|---|
onButtonClick | id | int | Update dialog button click event(0:confirm,1:cancel) |
start | / | / | Start download |
downloading | max | int | Downloading, apk file size |
progress | int | Current progress | |
done | apk | String | Downloaded, apk path |
cancel | / | / | Cancel download |
error | exception | String | Download error |
三、Screenshot #