setValueByKey method
void
setValueByKey(
- dynamic chiTietDon,
- String key, {
- dynamic value = "",
})
Implementation
void setValueByKey(dynamic chiTietDon, String key, {dynamic value = ""}) {
Control control = findControlInputFormAllPage(key);
if (value != "" && value != null) {
control.value.value = value;
return;
}
if (control.formatShow == FormatValuePresent.Percent) {
control.value.value = chiTietDon[key.toUpperCase()]?.toString() ?? "0";
} else if (control.formatShow == FormatValuePresent.Money) {
control.value.value =
chiTietDon[key.toUpperCase()]?.toInt()?.toString() ?? "0";
} else {
if (chiTietDon[key.toUpperCase()] != null) {
control.value.value = chiTietDon[key.toUpperCase()]?.toString() ?? "";
} else {
control.value.value = "";
}
}
}