You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the default order of documents in Firebase is by their ID instead of their creation date. So just reversing the order of messages doesn't do it (anymore). Maybe the messages need a third field with their creation date, so the client can then sort them by that date.
Edit: Figured it out. I didn't create a "time" field in my documents at all... So I went to firebase and created another field called "time" which is a "timestamp". Now they sort as they should.
I also modified chat_screen.dart with "'text': messageText,
'sender': loggedInUser!.email,
'time': FieldValue.serverTimestamp()" so every text I sent also sends timestamp with it. Hope this helps someone in the future
It seems that the default order of documents in Firebase is by their ID instead of their creation date. So just reversing the order of messages doesn't do it (anymore). Maybe the messages need a third field with their creation date, so the client can then sort them by that date.
Flash-Chat-Flutter-Complete/lib/screens/chat_screen.dart
Line 111 in a4b44e2
The text was updated successfully, but these errors were encountered: