sortMapKeys method
Implementation
Map<String, dynamic> sortMapKeys(Map<String, dynamic> map) {
final sortedMap = Map.fromEntries(
map.entries.toList()..sort((a, b) => a.key.compareTo(b.key)),
);
for (final key in sortedMap.keys) {
if (sortedMap[key] is Map) {
sortedMap[key] = sortMapKeys(sortedMap[key]);
}
}
return sortedMap;
}