evaluate function
Given a path
list, this method navigates through data
and returns
the last path, or null otherwise.
e.g.:
'my', 'key'
+ {'my': {'key': 'Value!'}} = 'Value!'
Implementation
Object? evaluate(Iterable<Object> path, Map<Object, dynamic>? data) {
Object? object = data;
for (final current in path) {
if (object is Map && object.containsKey(current)) {
object = object[current];
} else {
object = null;
break;
}
}
return object;
}