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

updat 封面
套件詳情v1.4.0

updat

Updat 是一個簡單易用且可靠的 Flutter-Native 更新工具,可處理您應用程式的更新。

AndroidiOSmacOSWindowsLinux
近 30 天下載
3100
喜歡數
39
Pub 分數
160

安裝套件

flutter pub add updat

套件介紹

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

Updat 是一個簡單可靠的 Flutter 原生套件,專為跨多個平台管理應用程式更新而設計。它簡化了在 Flutter 應用中檢查、下載和套用更新的流程。此套件著重於易於整合,支援 Android、iOS、macOS、Windows 和 Linux,非常適合需要強大更新機制的跨平台應用。該套件可處理背景下載、版本比較以及更新後的自動重新啟動,確保使用者獲得流暢的體驗。其輕量級設計與清晰的 API 讓各水準的開發人員都能輕鬆使用。

適用情境

  • 在跨平台 Flutter 應用中自動更新應用程式
  • 處理桌面和行動裝置上的靜默後台更新
  • 啟用更新安裝後的自動重啟
  • 在啟動或計劃間隔時管理更新檢查
  • 在更新嘗試失敗期間提供備用機制

主要特色

  • 跨平台支援(Android、iOS、macOS、Windows、Linux)
  • 簡單整合,程式碼量最少
  • 後台更新下載和安裝
  • 更新後自動重啟應用程式
  • 版本比較和更新檢測

適合對象

  • 開發跨平台 Flutter 應用的開發者
  • 需要可靠自動更新功能的團隊
  • 桌面和行動裝置上需要無縫更新體驗的應用程式
  • 在更新過程中最大限度減少用戶干預的專案至關重要
  • 面向技術知識有限環境中的使用者的應用程式

使用建議

  • 需要正確的伺服器端設定以更新清單
  • 可能需要自定義邏輯來處理更新回滾
  • 不適用於需要複雜更新工作流程的應用程式
  • 無需額外程式碼即可對更新的UI/UX進行有限自訂
  • 依賴於託管在伺服器上的外部更新元資料

原始 README

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

Updat - The simple-to-use, flutter-based desktop update package

Logo

Updat is a simple-to-use reliable flutter-native updater that handles your application's updates. All you need is a place to host your files and a place to check for the latest version.

License Pub.dev Github Issues Github Wiki

Demo

demo

Installing

To get started simply type flutter pub add updat in your terminal.

🎉 Done, It's that simple.

Getting Started

Integration with your app requires just a few lines of code, add the following widget wherever you want your updat widget to be:

UpdatWidget(
  currentVersion: "1.0.0",
  getLatestVersion: () async {
    // Here you should fetch the latest version. It must be semantic versioning for update detection to work properly.
    return "1.0.1";
  },
  getBinaryUrl: (latestVersion) async {
    // Here you provide the link to the binary the user should download. Make sure it is the correct one for the platform!
    return "https://github.com/latest/release/bin.exe";
  },
  // Lastly, enter your app name so we know what to call your files.
  appName: "Updat Example",
),

That should get you up and running in just a few seconds ⚡️.

or use the UpdatWindowManager, and let updat handle everything on autopilot. Just place it right after your MaterialApp.

Want to learn how to integrate Updat in your app?

Integration Instructions

Configuration

Available UpdatWidget arguments
Parameter Type Value Default
currentVersion String Required. Must be a semantic version. This is the current package's version. N/A
getLatestVersion Future<String> Required. Must be a semantic version. This should request the latest version to the server N/A
getBinaryUrl Future<String> Required. This should provide the link download the binary for a certain app version. Arguments: latestVersion N/A
appNme String Required. The Application's name. It is used to name the binaries when downloading. N/A
getChangelog Future<String> This will render a plain text view of the changelog. N/A
callback void Function(UpdatStatus) A callback that is called when the UpdatStatus gets updated. N/A
controller UpdatController Optional controller for programmatic update checks and actions. N/A
getDownloadFileLocation Future<File> Choose where to download the update. N/A
updateChipBuilder Widget Function(...) Overrides the default update chip. N/A
updateDialogBuilder Widget Function(...) Overrides the default update dialog. N/A
openOnDownload bool Whether Updat should open the installer automatically once it has been downloaded. true
closeOnInstall bool Whether Updat should close the application automatically once it has been downloaded. false
Theming

Logo

Updat is extremely easy to theme. We also use updateChipBuilder and updateDialogBuilder internally to design our widgets, so you have the same customizability we do. We provide a couple of themes to get you started.

To change the theme simply add the desired theme to the builder and you're set.

Chips
  • defaultChip which is an elevatedButton that only shows when an update is available. Shown by default.

  • defaultChipWithCheckFor which is an elevatedButton that shows under all conditions, allowing to recheck for updates.

  • defaultChipWithSilentDownload which is an elevatedButton that only shows when an update is downloaded and ready to install.

  • flatChip which is an textButton that only shows when an update is available

  • flatChipWithCheckFor which is an textButton that shows under all condition, allowing to recheck for updates.

  • flatChipWithSilentDownload which is an textButton that only shows when an update is downloaded and ready to install.

  • floatingExtendedChip which is a compact version of the dialog, which is a bit bigger and grabs user's attention more easily.

  • floatingExtendedChipWithSilentDownload which is a compact version of the dialog, which is a bit bigger and grabs user's attention more easily, and only shows when the update is ready to be installed.

Dialogs
  • defaultDialog which is the default, M2 and M3 dialog that shows by default.
Programmatic update checks

Use an UpdatController to re-check for updates after the initial check completes — for example when your backend signals a new release via push notification or websocket:

final updatController = UpdatController();

UpdatWindowManager(
  controller: updatController,
  // ...
)

// Later, when your backend alerts the user:
await updatController.checkForUpdate(notifyIfAvailable: true);

The *WithCheckFor chip themes also expose a UI button to recheck manually.

Advanced Usage

If you need to send additional HTTP headers when downloading a release asset, you may define your headers by setting the downloadReleaseHeaders property of UpdatGlobalOptions, you should probably do this in the main function of your code.

UpdatGlobalOptions.downloadReleaseHeaders = {
  "Authorization": "Bearer gh_pat_1234567889abcdefghijklm",
}

所屬分類

依賴

依賴清單 8 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。