versionarte 2.0.0 copy "versionarte: ^2.0.0" to clipboard
versionarte: ^2.0.0 copied to clipboard

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

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

πŸ’– Sponsors #

πŸ›« Getting Started #

Add the package and import it:

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

πŸ“‘ 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(),
);
copied to clipboard

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(),
);
copied to clipboard

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',
    ),
);
copied to clipboard

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);
  }
}
copied to clipboard

🎯 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);
      },
    );
} 
copied to clipboard

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.storeVersioning!.downloadUrls);
          }
        ),
      // other widgets
    ],
  );
}
copied to clipboard

πŸ”— Launching the Store #

To open the appropriate store for the current platform:

await Versionarte.launchDownloadUrl(result.downloadUrls);
copied to clipboard

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)
}
copied to clipboard

🐞 Need help? #

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

πŸ“ƒ License #

MIT License

97
likes
150
points
1.84k
downloads

Publisher

verified publisherkamranbekirov.com

Weekly Downloads

2024.09.06 - 2025.03.21

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

firebase_remote_config, flutter, http, package_info_plus, pub_semver, url_launcher

More

Packages that depend on versionarte