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
'개발 > Flutter' 카테고리의 다른 글
지도에 해당 지점이 어떤 지역 안에 있는 지 판별하기 (0) | 2022.12.22 |
---|---|
How to query flutter hive data ? (0) | 2022.12.17 |
how to compare boolean value? (0) | 2022.12.16 |
naver login 이 안 될 때 (flutter) (0) | 2022.12.12 |
Firebase dynamic link 안 될 때 (0) | 2022.12.12 |