how to query in firebase select condition where date is datenow

Viewed 55

I'm trying to query in my flutter application to show the user's input data that sort by date now. I have tried this

Stream<QuerySnapshot> getUserWorshipSnapshots(BuildContext context) async*{
//final Long server_timestamp = new DateTime.now().isUtc;
var currentTime = new DateTime.now();
final FirebaseUser user = await _auth.currentUser();
final uid = user.uid;
yield* Firestore.instance.collection('user').document(uid).collection('worship').orderBy('dateTime')
.startAt(currentTime).snapshots();}

enter image description here, and my firebase structure is like this enter image description here. is there any idea? thank you

1 Answers

You have a users collection and not a user collection, therefore add the missing s:

yield* Firestore.instance.collection('users').document(uid).collection('worship').orderBy('dateTime')
Related