app_version_update 套件簡化了檢查已安裝應用版本是否與 Google Play 商店或 Apple App Store 上可用的最新版本相符的過程。此套件讓開發者能夠無需依賴第三方服務即可程式化驗證更新。該套件支援 Android、iOS、macOS、Windows 及 Linux 等多個平台,非常適合跨平台應用。透過比對本機版本碼與商店版本,可於必要時提示使用者進行更新。
適用情境
啟動時檢查應用更新
透過應用內對話框提示使用者更新
驗證跨平台的版本一致性
在背景中自動檢查更新
支援多平台應用
主要特色
跨平台相容性
版本比較的簡單 API
與 Google Play 和 Apple App Store 的整合
輕量且無依賴
即時版本驗證
適合對象
跨平台 Flutter 應用
需要自動更新提示的應用程式
尋求最小化設定的開發者
針對 Android 和 iOS 的專案
需要版本同步驗證的應用
使用建議
需要互聯網連接以進行商店查詢
僅限應用商店和應用市場
不支援替代應用分發
版本代碼格式必須符合商店預期
頻繁檢查時可能需要處理速率限制
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Retrieve version and url for local app update against store app
Android and iOS
final appleId = '284882215'; // If this value is null, its packagename will be consideredfinal playStoreId = 'com.facebook.katana'; // If this value is null, its packagename will be consideredawaitAppVersionUpdate.checkForUpdates(
appleId: appleId, playStoreId: playStoreId)
.then((data) async {
print(data.storeUrl);
print(data.storeVersion);
if(data.canUpdate!){
//showDialog(... your custom widgets view) //or use our widgets// AppVersionUpdate.showAlertUpdate// AppVersionUpdate.showBottomSheetUpdate// AppVersionUpdate.showPageUpdateAppVersionUpdate.showAlertUpdate(
appVersionResult: data, context: context);
}
});
Customize the Alert Dialog
// you also have some options to customize our Alert Dialog AppUpdateVersion.showAlertUpdate(
{BuildContext? context,
AppVersionResult? appVersionResult,
bool? mandatory = false,
String? title = 'New version available',
TextStyle titleTextStyle =
constTextStyle(fontSize: 24.0, fontWeight: FontWeight.w500),
String? content = 'Would you like to update your application?',
TextStyle contentTextStyle =
constTextStyle(fontSize: 16.0, fontWeight: FontWeight.w400),
ButtonStyle? cancelButtonStyle = constButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.redAccent)),
ButtonStyle? updateButtonStyle = constButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.green)),
String? cancelButtonText = 'UPDATE LATER',
String? updateButtonText = 'UPDATE',
TextStyle? cancelTextStyle = constTextStyle(color: Colors.white),
TextStyle? updateTextStyle = constTextStyle(color: Colors.white),
Color? backgroundColor = Colors.white})