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

源码仓库

使用此插件的项目

暂无相关数据。