getUXPProps method
Implementation
UXPProps? getUXPProps(String? id, String? name) {
var filteredWidgets;
if (id == null && name != null) {
filteredWidgets = widgets.where((element) => element["name"] == name);
} else {
//int test = widgets.indexWhere((element) => element["name"] == name);
//print(test);
filteredWidgets = widgets
.where((element) => element["id"] == id && element["name"] == name);
}
if (filteredWidgets.length == 0) return null;
dynamic firstData = filteredWidgets.first;
Map<String, dynamic>? props = Map<String, dynamic>.from(firstData["props"]);
final uiPropsData = props["uiProps"];
//print(props["uiProps"]);
Map<String, dynamic> uxpPropsMap = {
"id": id,
"name": name,
"__template__": {
"id": props["__template__"]?["id"],
"type": props["__template__"]?["type"]
},
"uiProps": convertMapStringDynamic(uiPropsData)
};
//print(uxpPropsMap);
return UXPProps.fromJson(uxpPropsMap);
}