I have been trying to sort data which i get from firebase database below is the code I tried but this throws an error:
(NoSuchMethodError: Class "String" has no instance method 'orderBy').
What is the best practice to sort the data?
dateTime: snapshot.data.documents[index].data['dateTime'].orderBy('createdAt', descending: true),
Below I am adding the code from CrudMethods.
getData() async {
return await Firestore.instance.collection('PlasmaRequests').orderBy('createdAt', descending: true).snapshots();
}