mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 00:40:39 +00:00
internal remote config fetch error
This commit is contained in:
parent
f8b4c7f57f
commit
59d94bf1f1
2 changed files with 4 additions and 1 deletions
|
@ -24,7 +24,6 @@ class RemoteConfigService {
|
||||||
await remoteConfig.setDefaults(featuresDefaultValues.map((key, value) => MapEntry(key.name, value)));
|
await remoteConfig.setDefaults(featuresDefaultValues.map((key, value) => MapEntry(key.name, value)));
|
||||||
await remoteConfig.activate();
|
await remoteConfig.activate();
|
||||||
await remoteConfig.ensureInitialized();
|
await remoteConfig.ensureInitialized();
|
||||||
unawaited(remoteConfig.fetch());
|
|
||||||
|
|
||||||
log('Firebase remote config initialized successfully');
|
log('Firebase remote config initialized successfully');
|
||||||
} on FirebaseException catch (e) {
|
} 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);
|
dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature);
|
||||||
|
|
||||||
Map<Feature, dynamic> getAll() {
|
Map<Feature, dynamic> getAll() {
|
||||||
|
|
|
@ -26,6 +26,8 @@ class RemoteConfigProviderState extends State<RemoteConfigProvider> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.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(
|
_updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen(
|
||||||
_updateFeatures,
|
_updateFeatures,
|
||||||
onError: (e) => log(e.toString()),
|
onError: (e) => log(e.toString()),
|
||||||
|
|
Loading…
Reference in a new issue