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

源码仓库

使用此插件的项目

暂无相关数据。