mnemo_cards/lib/managers/repository/firebase_config_repository.dart
2024-07-03 23:56:13 +03:00

28 lines
609 B
Dart

import 'package:cloud_firestore/cloud_firestore.dart';
class FirebaseRepository {
static FirebaseFirestore get _firestore => FirebaseFirestore.instance;
static ConfigModel? _lastConfig;
static ConfigModel get appConfig {
update();
return _lastConfig!;
}
static Future<void> update() async {
_lastConfig = await _firestore
.collection('config')
.get()
.then((v) => v.docs.first)
.then((value) => value.data())
.then((value) => ConfigModel(value['path'] as String));
}
}
class ConfigModel {
final String path;
ConfigModel(this.path);
}