getByPath<T> method
T
getByPath<T>(
- JsonPath path
inherited
Implementation
T getByPath<T>(JsonPath path) {
dynamic value = this;
for (var segment in path.segments) {
if (value is MModel) {
value = value[segment];
} else if (value is Map) {
value = value[segment];
} else {
throw Exception(
"Illegal path: $path at segment $segment. Expected Map or MModel but found ${value.runtimeType}");
}
if (value == null) {
return null as T;
}
}
return value as T;
}