initialize method
Initialize the version update service and start listening for remote config updates
Implementation
Future<void> initialize() async {
if (_isInitialized) return;
logd('🔧 Initializing AppVersionUpdateService...');
_isInitialized = true;
// Wait for Remote Config to be fully initialized
await _waitForRemoteConfigInitialization();
// On first initialization, ensure we have the latest values
// Remote Config should already be initialized in main.dart, but let's ensure we have fresh values
await _ensureLatestRemoteConfigValues();
// Subscribe to remote config updates FIRST (works on all platforms including web)
// This ensures we catch any updates that happen during or after initialization
_subscribeToRemoteConfigUpdates();
// Add a small delay to ensure listener is established
await Future.delayed(const Duration(milliseconds: 500));
// Check current version status
await checkVersionUpdate();
logd('✅ AppVersionUpdateService initialization completed');
}