getValue method
!!! Be careful !!!
If you use this on your last coll, you will lose the auto index feature of firestore.
do not use this on your last coll.
!!! Be careful !!!
this will save a snapshot and listen the change of fields
must await this please
TODO: fix this: _streamHolder will be disposed because it is not static
Implementation
// FireColl getUserColl() {
// final userID = fs.auth.getNowUser()?.getID();
// if (userID == null) {
// throw Exception('no user');
// }
// return FireColl(_reference.collection(userID));
// }
// FireColl? getUserCollSafe() {
// final userID = fs.auth.getNowUser()?.getID();
// if (userID == null) {
// return null;
// }
// return FireColl(_reference.collection(userID));
// }
/// this will save a snapshot and listen the change of fields
///
/// must await this please
///
/// TODO: fix this: _streamHolder will be disposed because it is not static
Future<Object?> getValue(String key) async {
Object? rt;
final DocumentSnapshot<Map<String, dynamic>> snapshot = await _getSnapshot();
if (snapshot.exists) {
final data = snapshot.data();
if (data != null) {
rt = data[key];
}
}
return _castItem(rt);
}