From dc7adb84720930bfeeff2423b213bf9c8ecbb1ca Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Tue, 7 Nov 2023 11:48:05 +0100 Subject: [PATCH] fixed tests --- lib/data/remote_config_service.dart | 6 +++++- lib/providers/remote_config_provider.dart | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/data/remote_config_service.dart b/lib/data/remote_config_service.dart index b13629e..4405192 100644 --- a/lib/data/remote_config_service.dart +++ b/lib/data/remote_config_service.dart @@ -50,7 +50,11 @@ class RemoteConfigService implements IRemoteConfigService { } } - Future fetchConfig() => FirebaseRemoteConfig.instance.fetch(); + Future fetchConfig() async { + // https://github.com/firebase/flutterfire/issues/6196#issuecomment-927751667 + await Future.delayed(const Duration(seconds: 1)); + await FirebaseRemoteConfig.instance.fetch(); + } dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature); diff --git a/lib/providers/remote_config_provider.dart b/lib/providers/remote_config_provider.dart index 8a20833..4557ed6 100644 --- a/lib/providers/remote_config_provider.dart +++ b/lib/providers/remote_config_provider.dart @@ -26,8 +26,7 @@ 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()); + widget.remoteConfigService.fetchConfig(); _updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen( _updateFeatures, onError: (e) => log(e.toString()),