How to sort items by date in compose?

Viewed 28

I have a list of items and I want to sort them by date. And also I have this data class which contains the date.

data class Completed(
    @PrimaryKey
    val id:Int? = null,
    val title:String = "",
    val duration:String = "",
    val date:String = ""
)

I want to use the date variable to sort the items. Also the date should appear just one time, for example if you have a list of items in this day, it should not be like this picture below:

enter image description here

Instead the date 15 September should appear one time, how can do that?

0 Answers
Related