internal remote config fetch error

This commit is contained in:
Vadim 2023-11-07 10:56:44 +01:00
parent f8b4c7f57f
commit 59d94bf1f1
2 changed files with 4 additions and 1 deletions

View file

@ -24,7 +24,6 @@ class RemoteConfigService {
await remoteConfig.setDefaults(featuresDefaultValues.map((key, value) => MapEntry(key.name, value)));
await remoteConfig.activate();
await remoteConfig.ensureInitialized();
unawaited(remoteConfig.fetch());
log('Firebase remote config initialized successfully');
} on FirebaseException catch (e) {
@ -34,6 +33,8 @@ class RemoteConfigService {
}
}
Future<void> fetchConfig() => FirebaseRemoteConfig.instance.fetch();
dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature);
Map<Feature, dynamic> getAll() {

View file

@ -26,6 +26,8 @@ class RemoteConfigProviderState extends State<RemoteConfigProvider> {
@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()),