lookupNested method
looks up in nested maps by key like key1:key2:key3
Implementation
TValue? lookupNested(String key) {
if (key.isEmpty) {
throw Exception('Key is empty');
}
final keys = key.split(':').map((x) => x.trim()).toList();
Map<String, dynamic> current = this;
for (int i = 0; i < keys.length - 1; i++) {
final currKey = keys[i];
final curr = current[currKey] as Map<String, dynamic>?;
if (curr == null) {
return null;
}
current = curr;
}
return current.lookup(keys.last);
}