Use the status value to determine what action to take:
if (result.status == VersionarteStatus.inactive) {
// App is in maintenance modefinalString message = result.getMessageForLanguage('en');
showMaintenanceDialog(message);
} elseif (result.status == VersionarteStatus.forcedUpdate) {
// User must update to continueshowForceUpdateDialog(
onUpdate: () {
Versionarte.launchDownloadUrl(result.downloadUrls);
},
);
} elseif (result.status == VersionarteStatus.outdated) {
// Update available but optionalshowOptionalUpdateDialog(
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):
Widgetbuild(BuildContext context) {
returnColumn(
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:
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.