deepGet method
Safely retrieves a deeply nested value using a list of path keys.
{'user': {'address': {'city': 'NY'}}}.deepGet(['user','address','city'])
// 'NY'
Implementation
dynamic deepGet(List<String> path) {
dynamic current = this;
for (final key in path) {
if (current is Map && current.containsKey(key)) {
current = current[key];
} else {
return null;
}
}
return current;
}