checkUpdateIfNeed method
Implementation
Future<void> checkUpdateIfNeed({
required String updateUrl,
required String version,
}) async {
var packageInfo = await PackageInfo.fromPlatform();
if (packageInfo.version.compareTo(version) >= 0) {
return;
}
if (Platform.isIOS) {
// await OpenFile.open(updateUrl);
} else {
final savePath = await getTemporaryDirectory().then((dir) =>
'${dir.path}/update/${packageInfo.appName}-${packageInfo.version}.apk'); // 替换为实际的应用程序名称
await HttpService.to.download(updateUrl, savePath);
await OpenFile.open(savePath);
}
}