basic_force_update 1.0.6

SDKflutter

Basic Force Update

Force Update

A Flutter package that helps you implement force update functionality in your app. This package provides both dialog and bottom sheet options to prompt users to update your app when a new version is available.

Features

  • 🔄 Automatic version checking
  • 📱 Support for both iOS and Android platforms
  • 🎨 Customizable UI (Dialog and Bottom Sheet options)
  • 🔥 Firebase Remote Config integration
  • 🧪 Dummy provider for testing
  • 🛡️ Type-safe with proper null safety

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  basic_force_update: ^latest_version

Usage

1. Basic Setup

Wrap your app's root widget with ForceUpdateWidget:

ForceUpdateWidget(
  delegate: ForceUpdateDelegate(
    version: '1.0.0', // Your app's current version
    type: ForceUpdateType.dialog, // or ForceUpdateType.sheet
    title: 'Update Required',
    description: 'Please update to the latest version to continue using the app.',
    button: 'Update Now',
    appStoreId: 'YOUR_APP_STORE_ID', // For iOS
    packageName: 'YOUR_PACKAGE_NAME', // For Android
  ),
  provider: const DummyUpdateProvider(
    version: '1.0.1',
    active: true,
  ),
  child: YourApp(),
);

2. Using Firebase Remote Config

To use Firebase Remote Config for managing force updates:

ForceUpdateWidget(
  delegate: ForceUpdateDelegate(
    version: '1.0.0',
    type: ForceUpdateType.dialog,
    title: 'Update Required',
    description: 'Please update to continue.',
    button: 'Update Now',
    appStoreId: 'YOUR_APP_STORE_ID',
    packageName: 'YOUR_PACKAGE_NAME',
  ),
  provider: FirebaseForceUpdateProvider(
    key: 'your_remote_config_key', // Optional, defaults to 'update'
  ),
  child: YourApp(),
);

Firebase Remote Config JSON Structure

{
  "android": {
    "minimum": "1.0.1",
    "active": true
  },
  "ios": {
    "minimum": "1.0.1",
    "active": true
  }
}

3. Custom Update Provider

You can create your own update provider by implementing the ForceUpdateProvider interface:

class CustomUpdateProvider implements ForceUpdateProvider {
  @override
  FutureOr<ForceUpdateDetails?> getForceUpdateDetails() {
    // Implement your own logic to fetch update details
  }
}

ForceUpdateDelegate Properties

PropertyTypeDescription
versionStringCurrent app version
typeForceUpdateTypeDialog or Sheet
titleStringUpdate prompt title
descriptionStringUpdate description
buttonStringUpdate button text
appStoreIdString?iOS App Store ID
packageNameString?Android package name

Providers

DummyUpdateProvider

  • Useful for testing and development
  • Provides static update information

FirebaseForceUpdateProvider

  • Integrates with Firebase Remote Config
  • Allows dynamic update management
  • Supports different versions for iOS and Android