getComponent method
Implementation
AbstractComponent getComponent(
Component currentComponent, String currentPath) {
var paths = currentPath.split('/');
if (paths.length > 1) {
Component aComponent = currentComponent.children!
.map((pointer) => page[pointer?.getReference()!])
.where((element) => element!.type == ElementTypeEnum.component)
.map((element) => element as Component)
.where((component) => component.name == paths[0])
.first;
return getComponent(aComponent, paths.sublist(1).join('/'));
} else {
return currentComponent.children!
.map((pointer) => page[pointer?.getReference()!])
.where((element) =>
element!.type == ElementTypeEnum.component ||
element.type == ElementTypeEnum.container)
.map((element) => element as AbstractComponent)
.where((abstractComponent) => abstractComponent.name == paths[0])
.first;
}
}