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

套件詳情v2.1.2

versionarte

強制更新,顯示更新指示器並在維護期間停用應用程式,完全自由控制介面。

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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。