smart_update_manager 0.0.1
smart_update_manager: ^0.0.1 copied to clipboard
A plug-and-play solution to detect app updates and enforce soft or force updates on Android and iOS.
Smart Update Manager 📦 #
A plug-and-play solution to detect app updates and enforce soft or force updates on Android and iOS.

Features #
- ✅ Semantic Versioning: Robust numerical comparison (ignoring build numbers).
- ✅ Update States: Distinct logic for
Force,Soft, andNo Update. - ✅ Plug-and-Play UI: Default Material and Cupertino dialogs built-in.
- ✅ Store Redirection: Automatic handling for App Store and Play Store.
- ✅ Customizable: Override titles, messages, and behavior.
- ✅ Production Ready: Lightweight with minimal dependencies.
Installation #
Add the following to your pubspec.yaml:
dependencies:
smart_update_manager: ^0.0.1
Basic Usage #
1. Initialize Configuration #
Create an UpdateConfig with your version thresholds and store identifiers. Usually, you'll fetch these from your backend or Firebase Remote Config.
final config = UpdateConfig(
minimumRequiredVersion: AppVersion.parse('1.1.0'), // Force update below this
latestAvailableVersion: AppVersion.parse('1.2.0'), // Soft update below this
androidId: 'com.your.package',
iosId: '123456789',
);
2. Check and Show Update Dialog #
Call checkAndShowUpdate on app launch or whenever needed. The manager automatically detects the platform and shows the appropriate dialog.
await SmartUpdateManager.checkAndShowUpdate(
context,
config: config,
);
Advanced Customization #
You can customize the text and basic styling of the built-in dialogs:
await SmartUpdateManager.checkAndShowUpdate(
context,
config: config,
softUpdateTitle: 'New Version Found',
updateButtonText: 'Update Now!',
titleTextStyle: TextStyle(fontWeight: FontWeight.bold, color: Colors.deepPurple),
updateButtonStyle: ElevatedButton.styleFrom(backgroundColor: Colors.deepPurple),
barrierDismissible: true,
);
Full UI Customization #
For complete control over the UI, use the dialogBuilder. This allows you to show a bottom sheet, a full-screen page, or a completely custom dialog.
await SmartUpdateManager.checkAndShowUpdate(
context,
config: config,
dialogBuilder: (context, state, onUpdate, onLater) {
return MyCustomUpdateWidget(
isForce: state == UpdateState.force,
onUpdate: onUpdate,
onLater: onLater,
);
},
);
Manual Control #
If you prefer to build your own UI, you can just use the logic directly:
final state = await SmartUpdateManager.checkUpdate(config);
if (state == UpdateState.force) {
// Show your own custom full-screen blocking UI
}
Supported Platforms #
| Platform | Supported | Redirection |
|---|---|---|
| Android | ✅ | Google Play Store |
| iOS | ✅ | Apple App Store |
License #
MIT