getValidProps static method
Implementation
static List<Property> getValidProps(
IotWidgetElement selectedIotWidgetElement, ValidDevice validDevice) {
List<Property> list = [];
if (validDevice.device.nodes.length > 0) {
validDevice.device.nodes.forEach((node) {
if (node.isConfig == true) return;
int nodeCount = 1;
int minIndex = 0;
int maxIndex = 0;
if (node.array.length > 0) {
// multiple nodes
List<String> splittedArr = node.array.split("-");
int maxIndex = int.parse(splittedArr[1]);
int minIndex = int.parse(splittedArr[0]);
nodeCount = maxIndex - minIndex + 1;
}
for (int i = minIndex; i < maxIndex + 1; i++) {
node.properties.forEach((prop) {
if (isDatatypeAcceptable(selectedIotWidgetElement, prop) &&
isSettableSuitable(selectedIotWidgetElement, prop) &&
isRetainedSuitable(selectedIotWidgetElement, prop)) {
Property property = Property.copyFrom(prop);
if (nodeCount != 1) {
property.parentId = "${prop.parentId}_${i.toString()}";
property.name = "${prop.name} ${i.toString()}";
}
list.add(property);
} else if (isVendorDeviceValid(selectedIotWidgetElement, prop)) {
list.add(prop);
}
});
}
});
}
return list;
}