Can someone give me a hint? I want to sort a map\'s values by the length of the lists.
var chordtypes = {
\"maj\": [0, 4, 7],
\"M7\": [0, 4, 7, 11],
\"
Using DART language:
Let's say you want to sort a Map with integer key and value of type Foo:
class Foo {
int x; //it can be any type
}
So you can get the list of all the entries, sort them like a normal list and then rebuild the map:
Map map = //fill map
var entries = map.entries.toList();
entries.sort((MapEntry a, MapEntry b) => a.value.x.compareTo(b.value.x));
map = Map.fromEntries(entries);