sortedKeysByValue method

List<K> sortedKeysByValue(
  1. int compare(
    1. V,
    2. V
    )?
)

Implementation

List<K> sortedKeysByValue(int Function(V, V)? compare) {
  List<V> v = this.values.sorted(compare);
  return List.generate(
      v.length,
      (index) =>
          this.keys.firstWhere((element) => this[element] == v[index]));
}