sort static method

Map<String, dynamic> sort(
  1. Map<String, dynamic> map
)

Takes the given map and orders its values based on their keys. Returns the sorted map.

Implementation

static Map<String, dynamic> sort(Map<String, dynamic> map) {
  // Get the sorted keys
  final sortedKeys = map.keys.toList();
  sortedKeys.sort();

  // Sort each value
  final result = SplayTreeMap<String, dynamic>();
  sortedKeys.forEach((key) {
    result[key] = _encodeValue(map[key]);
  });

  return result;
}