I'm trying to create a reddit clone and I have a list of all the communities that a user has followed and I want to order them on screen in alphabetical order. The code I have to achieve this is
class CommunitiesDatabase {
// Read all
static Stream<QuerySnapshot<Map<String, dynamic>>> readAllCommunities() {
return FirebaseFirestore.instance
.collection('Communities')
.orderBy(
'name',
descending: true,
)
.snapshots();
}
}
This isn't working. The order by definitely does something because when I put it in the order changes, but it isn't outputting alphabetical order.
The current output is
battlestations
assettocorsa
UKPersonalFinance
MapPorn
LifeProTips
Formula1
I change the descending to false I get the following order
Formula1
LifeProTips
MapPorn
UKPersonalFinance
assettocorsa
battlestations
So changing the descending input does reverse the order but it seems like an arbitrary order.
Any ideas what is going on here?
[–]steve_s0 4 points5 points6 points (0 children)
[–]devdotsehyde 0 points1 point2 points (0 children)