one to many

This commit is contained in:
Gaurav Kumar
2025-09-22 09:05:32 +05:30
parent 6ace7ced7b
commit f3acdf65c0
3 changed files with 714 additions and 191 deletions

View File

@@ -605,7 +605,19 @@ class _EntityFormState extends State<EntityForm> {
continue;
}
formData[key] = value;
// Handle JSON parsing for OneToMany fields
final bool parseAsJson = props['parseAsJson'] == true;
if (parseAsJson && value.isNotEmpty) {
try {
final decoded = json.decode(value);
formData[key] = decoded;
} catch (e) {
// If JSON parsing fails, send as string
formData[key] = value;
}
} else {
formData[key] = value;
}
}
widget.onSubmit(formData);
}