resolveSwitch method
Implementation
Node? resolveSwitch(Switch switchNode) {
final bindRules = switchNode.children.where(
(c) => c.xmlTagName == 'bindRule',
);
for (var bindRule in bindRules) {
final ruleId = bindRule.rawAttributes['rule'];
final constituentId = bindRule.rawAttributes['constituent'];
if (ruleId != null && constituentId != null) {
if (evaluateRule(ruleId)) {
final res = getNodeById(constituentId);
if (res != null) return res;
}
}
}
final defaultComp = switchNode.children
.where((c) => c.xmlTagName == 'defaultComponent')
.firstOrNull;
if (defaultComp != null) {
final compId = defaultComp.rawAttributes['component'];
if (compId != null) {
return getNodeById(compId);
}
}
return null;
}