You can define you own compare function for bool
and pass it to the sort
method of List
.
Example with booleans
as your bool
List
:
booleans.sort((a, b) {
if(b) {
return 1;
}
return -1;
});
This example tells the sort
method that true
elements should be sorted higher than false
elements.