From 98c96577fb129b7bc46e794ae85e3dcf0bdbb580 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:56:44 +0100 Subject: [PATCH] internal remote config fetch error --- lib/data/remote_config_service.dart | 8 +------- lib/providers/remote_config_provider.dart | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/data/remote_config_service.dart b/lib/data/remote_config_service.dart index f8c123b..b13629e 100644 --- a/lib/data/remote_config_service.dart +++ b/lib/data/remote_config_service.dart @@ -50,14 +50,8 @@ class RemoteConfigService implements IRemoteConfigService { } } - @override - Future fetchConfig() async { - // https://github.com/firebase/flutterfire/issues/6196#issuecomment-927751667 - await Future.delayed(const Duration(seconds: 1)); - await FirebaseRemoteConfig.instance.fetch(); - } + Future fetchConfig() => FirebaseRemoteConfig.instance.fetch(); - @override dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature); @override diff --git a/lib/providers/remote_config_provider.dart b/lib/providers/remote_config_provider.dart index b8a7c75..8a20833 100644 --- a/lib/providers/remote_config_provider.dart +++ b/lib/providers/remote_config_provider.dart @@ -26,6 +26,8 @@ class RemoteConfigProviderState extends State { @override void initState() { super.initState(); + // https://github.com/firebase/flutterfire/issues/6196#issuecomment-927751667 + Future.delayed(const Duration(seconds: 1)).then((_) => widget.remoteConfigService.fetchConfig()); _updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen( _updateFeatures, onError: (e) => log(e.toString()),