How to sort data on the bases of Priority HIGH,Medium and Low in jetpack compose

Viewed 98
sealed class Priority{
    object High : Priority()
    object Medium : Priority()
    object Low : Priority()
}

I did not be able to sort the data in lazy column on the basis of high,medium and low

1 Answers

Change your sealed class to this

sealed class Priority(value: Int){
    object High : Priority(3)
    object Medium : Priority(2)
    object Low : Priority(1)
}

And sort your items by priority.value

Related