搜索插件、代码仓与 APP 分类

插件详情v2.1.2

versionarte

强制更新,显示更新指示器,并在维护期间禁用应用程序,UI 自由度完全掌控。

AndroidiOSWebmacOSWindows
近 30 天下载
758
喜欢数
173
Pub 分数
150

安装插件

flutter pub add versionarte

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Versionarte 是一个 Flutter 包,可帮助开发者强制应用更新、显示自定义更新指示器,并在维护期间临时禁用应用。它提供了对更新提示和维护屏幕 UI 的完全控制,确保用户始终使用最新版本或了解停机时间。专为跨平台应用设计,可在 Android、iOS、Web、macOS 和 Windows 上无缝运行。通过 pub add 轻松集成,并在版本检查和更新期间提供灵活的用户体验。

适合场景

  • 强制执行强制应用更新
  • 显示自定义更新横幅
  • 显示维护模式屏幕
  • 处理版本兼容性
  • 在停机期间管理用户访问
  • 按平台自定义更新 UI

主要特点

  • 更新屏幕的完整用户界面自定义
  • 对多个平台的支持
  • 灵活的版本检查逻辑
  • 维护模式强制执行
  • 与 pub 的轻松集成
  • 可配置的更新触发器

适合对象

  • 需要严格版本控制的应用程序
  • 需要自定义更新用户体验的开发者
  • 跨平台应用程序
  • 管理频繁发布的工作团队
  • 具有计划维护时段的应用程序
  • 在更新期间优先考虑用户体验的项目

使用建议

  • 需要手动配置版本检查
  • UI 组件必须由开发人员实现
  • 可能需要后端支持以进行版本验证
  • 不适用于没有更新策略的应用程序
  • 有限的内置分析功能
  • 依赖于准确的版本跟踪

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

versionarte

Force update, show update indicator and disable the app for maintenance with total freedom over the UI.

😎 Benefits

  • ✋ Force users to update to the latest version
  • 💆🏻‍♂️ Have separate values for each platform
  • 🚧 Disable app for maintenance with custom informative text
  • 🆕 Inform users about an optional update availability
  • 🔗 Launch the App Store on iOS and Play Store on Android
Forced update New version indicator Maintenance mode

Read the How to force users to update your Flutter app article for detailed explanation.

🩵 Sponsors

🛫 Getting Started

Add the package and import it:

dependencies:
  versionarte: <latest_version>
import 'package:versionarte/versionarte.dart';

📡 Checking Version Status

Call Versionarte.check with a provider to get the app's versioning status:

// Using Firebase Remote Config (most common)
final VersionarteResult result = await Versionarte.check(
    versionarteProvider: RemoteConfigVersionarteProvider(),
);

Tip: Pass silent: true to suppress debug console logs.

Choose from three provider types based on your backend:

1. Using Firebase Remote Config

Recommended for apps already using Firebase

final VersionarteResult result = await Versionarte.check(
    versionarteProvider: RemoteConfigVersionarteProvider(),
);

Optional parameters:

  • keyName: Firebase config key (default: "versionarte")
  • initializeInternally: Set to false if your app already initializes Firebase
  • remoteConfigSettings: Custom settings if needed

See Firebase Remote Config setup guide for configuration details.

2. Using RESTful API

Recommended for apps with custom backends

final VersionarteResult result = await Versionarte.check(
    versionarteProvider: RestfulVersionarteProvider(
        url: 'https://myapi.com/getVersioning',
    ),
);

Optional parameters:

  • headers: Custom HTTP headers if needed

Note: Your RESTful endpoint must return the same JSON structure as shown in the Configuration JSON section below.

3. Using Custom VersionarteProvider

For advanced use cases with custom data sources

class MyCustomVersionarteProvider extends VersionarteProvider {
  @override
  Future<DistributionManifest> getDistributionManifest() async {
    final String result = MyCustomService.fetchVersioning();
    final Map<String, dynamic> decodedResult = jsonDecode(result);
    
    return DistributionManifest.fromJson(decodedResult);
  }
}

🎯 Handle the Status

Use the status value to determine what action to take:

if (result.status == VersionarteStatus.inactive) {
    // App is in maintenance mode
    final String message = result.getMessageForLanguage('en');

    showMaintenanceDialog(message);
} else if (result.status == VersionarteStatus.forcedUpdate) {
    // User must update to continue
    showForceUpdateDialog(
      onUpdate: () {
        Versionarte.launchDownloadUrl(result.downloadUrls);
      },
    );
} else if (result.status == VersionarteStatus.outdated) {
    // Update available but optional
    showOptionalUpdateDialog(
      onUpdate: () {
        Versionarte.launchDownloadUrl(result.downloadUrls);
      },
    );
} 

Tip: You can also show different widgets based on status. For example, when the app is outdated, you might want to show an update indicator anywhere in your app (for example in home page):

Widget build(BuildContext context) {
  return Column(
    children: [
      // other widgets   
      if (result.status == VersionarteStatus.outdated)
        // A custom widget to show "Update available"
        NewVersionAvailableIndicator(
          onUpdate: () {
            Versionarte.launchDownloadUrl(result.downloadUrls);
          }
        ),
      // other widgets
    ],
  );
}

🔗 Launching the Store

To open the appropriate store for the current platform:

await Versionarte.launchDownloadUrl(result.downloadUrls);

Note: Add "download_url" in your configuration JSON for each platform. The correct store opens automatically based on the current platform.

See the example directory for a complete sample app.

🖋️ Configuration JSON

The configuration JSON contains versioning and status information for each platform. Only configure platforms that your app supports.

{
    "android": {
        "version": {
            "minimum": "2.7.0", // Minimum required version
            "latest": "2.8.0"   // Latest available version
        },
        "download_url": "https://play.google.com/store/apps/details?id=app.example",
        "status": {
            "active": true,     // Whether app is currently active
            "message": {        // Only needed if active is false
                "en": "App is in maintenance mode, please come back later.",
                "es": "La aplicación está en modo de mantenimiento, vuelva más tarde."
            }
        }
    },
    "iOS": {
        // Same structure as Android
    },
    // Optional: Include other platforms if needed (macOS, windows, linux)
}

🐞 Need help?

If you encounter any problems or need a feature, please raise a ticket on GitHub.

📃 License

MIT License

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。