How to group firebase data in flutter with DateTime?

I am making a chat application in flutter using firebase. I want to show a header with the date whenever the date changes. How can I group messages in flutter coming from firebase on the basis of date and show a header with the changed date?

I have tried GroupedListView package but I was not able to retrieve the chatmessages successfully.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum