convertVariableToValue method
extract variables API collection form string
Implementation
String convertVariableToValue(List<VariableModel> vars) {
List<String> nameList = split(" ");
for (String i in nameList) {
if (i.startsWith("{{") && i.endsWith("}}")) {
int index = nameList.indexWhere((element) => element.contains(i));
nameList[index] = vars
.where((element) =>
element.key.toLowerCase() ==
i.replaceAll("{{", "").replaceAll("}}", ""))
.firstOrNull?.value ?? "";
}
}
return nameList.join(" ");
}