应用版本检查器
此包用于检查您的应用程序在Play商店或Apple App Store上是否有新版本。
您甚至可以检查Play商店或Apple App Store上另一个应用程序的最新版本。
安装
在您的pubspec中添加App Version Checker
dependencies:
flutter_app_version_checker: any # or the latest version on Pub
用法
final _checker = AppVersionChecker();
@override
void initState() {
super.initState();
checkVersion();
}
void checkVersion() async {
_checker.checkUpdate().then((value) {
print(value.canUpdate); //return true if update is available
print(value.currentVersion); //return current app version
print(value.newVersion); //return the new app version
print(value.appURL); //return the app url
print(value.errorMessage); //return error message if found else it will return null
});
}
或者
final _checker = AppVersionChecker(
appId: "specify the app id (optional)",
currentVersion: "specify the current version (optional)");
...