save method
dynamic
save()
Implementation
save() {
_fields.forEach((key, QUFormFieldState? field) {
field?.save();
});
final Map<String, dynamic> thisValue = {};
formValue.forEach((key, value) {
thisValue.addAll({
key: value is List<QUFormSelectOptionModel>
? value.map((item) => item.toJson()).toList()
: value is QUFormSelectOptionModel
? value.toJson()
: value
});
});
final cThisValue = Map<String, dynamic>.unmodifiable(thisValue);
cThisValue.forEach((key, value) {
if (key.startsWith('subform')) {
for (var i = 0; i < value.length; i++) {
cThisValue.forEach((formItemkey, formItemValue) {
final curI = '{bind}${value[i]}{bind}';
if (formItemkey.endsWith('$curI$key')) {
final newI = '{bind}$i{bind}';
if (curI != newI) {
final newKey = formItemkey.replaceAll(curI, newI);
thisValue.remove(formItemkey);
thisValue.addAll({newKey: formItemValue});
}
}
});
}
thisValue.remove(key);
}
});
return thisValue;
}