In my realtime database I have a series of date strings acting as keys in the format of yyyy-mm-dd. These dates are stored under a user's uid:
I need to get a range of these dates in a sorted order. I can get the dates sorted, but when I try to do a startAt() and endAt() nothing is returned. If I just do a startAt() everything is returned.
This gives me an ordered list:
var query = _database.reference().child(DAY_TABLE).child(UserState.instance.user.uid).orderByValue();
query.onChildAdded.forEach((day) {
dayList.add(Day.fromJson({day.snapshot.key: day.snapshot.value}));
});
What I'd like to do but doesn't work:
var query = _database.reference().child(DAY_TABLE).child(UserState.instance.user.uid).orderByValue().startAt("2020-09-12").endAt("2020-09-19")
Where the above query would include any and all dates between 2020-09-12 and 2020-09-19. How can I specify such a range?
I thought I might have to convert the date strings to a Unix time, but because I am able to sort the dates correctly, it seems like there should be a way to get this to work. I would prefer to keep them as date strings if it is possible as it is more obvious to work with.
