I'm making a reddit clone in Flutter and using Cloud Firestore to store my data. I have a list of Communities that a user is following and want to show that in alphabetical order.
My current code is as follows:
class CommunitiesDatabase {
// Read all
static Stream<QuerySnapshot<Map<String, dynamic>>> readAllCommunities() {
return FirebaseFirestore.instance
.collection('Communities')
.orderBy(
'name',
descending: true,
)
.snapshots();
}
}
This is outputting the following list:
battlestations
assettocorsa
UKPersonalFinance
MapPorn
LifeProTips
Formula1
If I change the descending
option to false
it does reverse the order, but it still isn't alphabetical.
Can anyone help me understand why?