개발/Flutter
dart 2차 정렬하기 (twice ordering)
dev_caleb
2022. 12. 16. 21:06
728x90
https://stackoverflow.com/questions/55920677/how-to-sort-a-list-based-on-two-values
How to sort a list based on two values
I have a list in which I want to sort based on two values date and the status like this: pollsList.sort((a, b) => b.active.compareTo(a.active)); pollsList.sort((a, b) { return b.
stackoverflow.com
pollsList.sort((a, b) {
int cmp = b.actualStartDatetime.compareTo(a.actualStartDatetime);
if (cmp != 0) return cmp;
return b.active.compareTo(a.active);
});
1차 정렬할 수 있는 사람은 아래를 이해할 수 있을 듯!

728x90