mnemo_cards/lib/managers/repository/firebase_config_repository.dart

29 lines
612 B
Dart
Raw Normal View History

2024-05-22 20:48:44 +00:00
import 'package:cloud_firestore/cloud_firestore.dart';
class FirebaseRepository {
static FirebaseFirestore get _firestore => FirebaseFirestore.instance;
static ConfigModel? _lastConfig;
static ConfigModel get appConfig {
2024-08-05 00:12:20 +00:00
// update();
2024-05-22 20:48:44 +00:00
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);
}