搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目

暂无相关数据。