Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

flutter dart sort list of objects

objects.sort((a, b) {
  return a.value['name'].toString().toLowerCase().compareTo(b.value['name'].toString().toLowerCase());
});
To reverse it you could do b.someProperty.compareTo(a.someProperty). Or sort it and then use .reversed
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flutter #dart #sort #list #objects
ADD COMMENT
Topic
Name
7+2 =