搜尋套件、儲存庫與 APP 分類

new_version 封面
套件詳情v0.3.1

new_version

檢查您的使用者是否擁有您 Flutter 應用程式最新的版本。

AndroidiOSmacOSWindowsLinux
近 30 天下載
456
喜歡數
618
Pub 分數
130

安裝套件

flutter pub add new_version

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

new_version 套件幫助 Flutter 應用程式透過檢查遠端來源(例如 JSON 檔案或 API 端點)上的指定版本,來判斷目前版本是否為最新。它支援多個平台,包括 Android、iOS、macOS、Windows 和 Linux。此套件讓開發者能在有新版本可用時提示使用者更新應用程式,進而改善使用者體驗,並確保能存取最新的功能與安全修復。它輕量且易於整合,設定需求極少。

適用情境

  • 提示使用者更新應用
  • 在應用啟動時檢查更新
  • 驗證版本相容性
  • 通知使用者新版本發佈
  • 與 CI/CD 工作流程整合

主要特色

  • 跨平台支援
  • 簡單整合
  • 遠端版本檢查
  • 可自定義的更新提示
  • 支援 JSON 和 HTTP 端點

適合對象

  • 需要版本控制的應用程式
  • 開發者管理應用更新
  • 頻繁發佈專案
  • 面向用戶的移動應用
  • 使用自動化部署的團隊

使用建議

  • 需要互聯網連接
  • 依賴外部版本來源
  • 可能需要快取策略
  • 不適用於離線優先的應用程式
  • 版本比較邏輯必須定義

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Archive Notice

This plugin is relatively stable and feature-complete, but I won't be working on it or accepting pull requests going forward. If anyone is interested in taking over as maintainer, feel free to email me. I'm also happy to link to popular forks that have spun off. Thanks.

New Version Plugin 🎉

A Flutter plugin that makes it possible to:

  • Check if a user has the most recent version of your app installed.
  • Show the user an alert with a link to the appropriate app store page.

See more at the Dart Packages page.

Screenshots

Installation

Add new_version as a dependency in your pubspec.yaml file.

dependencies:
  new_version: ^0.3.0

Usage

In main.dart (or wherever your app is initialized), create an instance of NewVersion.

final newVersion = NewVersion();

The plugin will automatically use your Flutter package identifier to check the app store. If your app has a different identifier in the Google Play Store or Apple App Store, you can overwrite this by providing values for androidId and/or iOSId.

For iOS: If your app is only available outside the U.S. App Store, you will need to set iOSAppStoreCountry to the two-letter country code of the store you want to search. See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes.

You can then use the plugin in two ways.

Quickstart

Calling showAlertIfNecessary with your app's BuildContext will check if the app can be updated, and will automatically display a platform-specific alert that the user can use to go to the app store.

newVersion.showAlertIfNecessary(context: context);

Advanced 😎

If you want to create a custom alert or use the app version information differently, call getVersionStatus. This will return a Future<VersionStatus> with information about the local and app store versions of the app.

final status = await newVersion.getVersionStatus();
status.canUpdate // (true)
status.localVersion // (1.2.1)
status.storeVersion // (1.2.3)
status.appStoreLink // (https://itunes.apple.com/us/app/google/id284815942?mt=8)

If you want to present a customized dialog, you can pass your VersionStatus to showUpdateDialog().

newVersion.showUpdateDialog(
  context: context, 
  versionStatus: status,
  dialogTitle: 'Custom dialog title',
  dialogText: 'Custom dialog text',
  updateButtonText: 'Custom update button text',
  dismissButtonText: 'Custom dismiss button text',
  dismissAction: () => functionToRunAfterDialogDismissed(),
)

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。