initialize method
Initializes the Remote Config service.
Sets the configuration settings for fetching and activates the fetched values. This method should be called once, typically during application startup.
Implementation
Future<void> initialize() async {
// Prevent re-initialization.
if (_isInitialized) return;
// Configure fetch timeout and minimum fetch interval.
await _remoteConfig.setConfigSettings(RemoteConfigSettings(
fetchTimeout: const Duration(seconds: 10),
minimumFetchInterval: const Duration(hours: 1),
));
// Fetch and activate the remote config values.
await _remoteConfig.fetchAndActivate();
_isInitialized = true;
}