Answers for "sort list descending from spesific maps key in dart"

1

sort list descending from spesific maps key in dart

// if you want to sort obejects descendingly, use b compare to a
 
 topContributors.sort((a, b) => b['amount'].compareTo(a['amount']));
 
 // if you want to reverse the order of list, just use
 
 topContributors.reversed.toList();
Posted by: Guest on August-19-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language