checkUpdate method
Checks if an update is available for the app in the store.
This method identifies the store from where the app was installed and checks for an available update. It also allows providing a specific store type or version for comparison.
store - Optional, specify the store to check. If null, it will auto-detect.
storeVersion - Optional, specify a version to compare with the store's version.
Returns true if an update is available, otherwise false.
Implementation
Future<bool> checkUpdate({StoreType? store, String? storeVersion}) async {
try {
// Determine the store type (App Store, Google Play, etc.)
final type = store ?? await getStoreType();
if (type == null) return false;
// Get the data source for the specific store type
final source = await _getStoreDataSource(type);
if (source == null) return false;
// Check if an update is available in the store
return _checkUpdateStore(source, storeVersion: storeVersion);
} on Exception catch (e) {
debugPrint('[🔄 Update: checkUpdate] err: $e');
return false;
}
}