accessValue function
this function nests into the map following the path, which is a list of each key to follow, finally, it returns the found value, or null if not found
Implementation
dynamic accessValue(List<String> path, dynamic map) {
if (path.isEmpty) {
return map;
}
final String key = path.first;
if (map is Map && map.containsKey(key)) {
return accessValue(path.sublist(1), map[key]);
} else {
return map;
}
}