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

updater 封面
套件詳情v0.2.5

updater

一個用於檢查 Flutter 自訂應用內更新的套件。

Android
近 30 天下載
144
喜歡數
41
Pub 分數
150

安裝套件

flutter pub add updater

套件介紹

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

更新程式套件讓 Flutter 應用能夠檢查自訂的內應用更新,讓開發者能管理版本控制並直接在應用內提示使用者更新。專為 Android 設計,此套件透過從使用者定義的來源取得更新詳情,順暢整合至現有工作流程。這有助於維持應用品質,並確保使用者使用最新版本,而不需完全依賴應用商店更新。該套件輕量且易於實作,設定需求極少。

適用情境

  • 應用內更新通知
  • 自定義更新邏輯
  • 使用者驅動的更新提示
  • 版本相容性檢查
  • 應用維護
  • 離線更新檢測

主要特色

  • 自定更新來源支援
  • 僅限 Android 平台的目標
  • 簡單整合
  • 輕量化設計
  • 可設定的更新檢查
  • 無外部依賴

適合對象

  • 開發人員管理應用版本
  • 需要受控更新發布的應用程式
  • 頻繁發佈專案
  • 使用內部或私有更新伺服器的團隊
  • 針對 Android 的 Flutter 應用

使用建議

  • 僅限 Android 平台
  • 需要手動更新元數據設置
  • 不支援 iOS
  • 依賴外部伺服器獲取更新資訊
  • 不適合用於公開應用商店更新
  • 需要安全連接以更新端點

原始 README

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

Version

A package to check for the custom in-app updates for Flutter.

⭐ Installing

dependencies:
    updater: ^0.2.5

⚡ Import

import 'package:updater/updater.dart';
Android IOS
Supported ✔️ ❌
alt text

Properties

context → BuildContext
url → String
titleText → String
contentText → String
confirmText → String
cancelText → String
elevation → double
rootNavigator → bool
allowSkip → bool
backgroundDownload → bool
callBack → Function(String, int, String, int String)
controller → UpdaterController
delay → Duration
enableResume → bool

UpdateStatus

UpdateStatus.Checking
UpdateStatus.Pending
UpdateStatus.Available
UpdateStatus.Dowloading
UpdateStatus.Paused
UpdateStatus.Resume
UpdateStatus.Cancelled
UpdateStatus.Completed
UpdateStatus.DialogDismissed
UpdateStatus.Failed

Json Structure

versionCode → int
versionName → String
minSupport → int
contentText → String
url → String 
{
  "versionCode":3,
  "versionName":"1.0.0",
  "contentText":"Please update your app",
  "minSupport":2,
  "url":"/*App Download Url*/"
}
versionCode:   //Specify new version code
versionName:   //specify version name
minSuppor:     //specify minimum supported version to force update
contentText:   //specify content text, if contentText is not defined in app then this will be use
url:          //App file download link

⚙ Setup

Android
  • Add REQUEST_INSTALL_PACKAGES permission to open and install apk file
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

📙 How To Use

Inside pubspec.yaml file

# Specify version code using +VersionCode
version: 1.0.0+1  #Like here the VersionCode is 1
    //Controller
    UpdaterController controller = UpdaterController(
        listener: (UpdateStatus status) {
            print('Listener: $status');
        },
        onChecked: (bool isAvailable) {
            print(isAvailable);
        },
        progress: (current, total) {
            print('Progress: $current -- $total');
        },
        onError: (status) {
            print('Error: $status');
        },
    );


    Updater updater = Updater(
        context: context,
        controller: controller,
        url: 'JSON_FILE_URL',
        titleText: 'Update available',
        // backgroundDownload: false,
        // allowSkip: false,
        contentText:
            'Update your app to the latest version to enjoy new feature.',
        callBack: (UpdateModel model) {

          print(model.versionName);
          print(model.versionCode);
          print(model.contentText);
          
        },
        
        enableResume: false,
    );
    updater.check();
    
    
    //To cancel the download
    //controller.cancel();


    //To pause the download
    //controller.pause();

    //To resume the download
    //controller.resume();

    
    

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。