Skip to content

Instantly share code, notes, and snippets.

@Vamshi3130
Created December 5, 2023 07:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vamshi3130/3988618fe5133bfe64de9146328785ca to your computer and use it in GitHub Desktop.
Save Vamshi3130/3988618fe5133bfe64de9146328785ca to your computer and use it in GitHub Desktop.
enchanted-osmium-5098

enchanted-osmium-5098

Created with <3 with dartpad.dev.

Map? formFields = {
"tree": {
"id": "656acaf40ab414d09ffd2989",
"name": "Name",
"attributes": {"label": ""},
"field": {
"id": "656acaf40ab414d09ffd2989",
"form_id": "000000000000000000000000",
"field_name": "Name",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"field_status": "draft",
"action_enabled": false,
"source_form_id": "656acad30ab414d09ffd2988"
},
"children": [
{
"id": "656ad06b0ab414d09ffd298c",
"name": "Reason for hospital visit",
"attributes": {"label": ""},
"field": {
"id": "656ad06b0ab414d09ffd298c",
"form_id": "000000000000000000000000",
"field_name": "Reason for hospital visit",
"field_value": [
"Fever",
"joint pains",
"Eye problem",
"Ear pain",
"tooth ache"
],
"field_type": "radioButton",
"field_use_type": "Analytical",
"field_status": "draft",
"action_enabled": true,
"source_form_id": "656acad30ab414d09ffd2988"
},
"children": [
{
"id": "656ad07f0ab414d09ffd298d",
"name": "General physician ",
"attributes": {"label": "x == Fever"},
"field": {
"id": "656ad07f0ab414d09ffd298d",
"form_id": "000000000000000000000000",
"field_name": "General physician ",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [],
"option": "x == Fever"
},
{
"id": "656ad08a0ab414d09ffd298e",
"name": "orthopedician",
"attributes": {"label": "x == joint pains"},
"field": {
"id": "656ad08a0ab414d09ffd298e",
"form_id": "000000000000000000000000",
"field_name": "orthopedician",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad0cd0ab414d09ffd2993",
"name": "Pharmacy",
"attributes": {"label": "x Contains "},
"field": {
"id": "656ad0cd0ab414d09ffd2993",
"form_id": "000000000000000000000000",
"field_name": "Pharmacy",
"field_value": ["Yes", "No"],
"field_type": "radioButton",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
}
],
"option": "x Contains "
}
],
"option": "x == joint pains"
},
{
"id": "656ad09b0ab414d09ffd298f",
"name": "opthomalagist",
"attributes": {"label": "x == Eye problem"},
"field": {
"id": "656ad09b0ab414d09ffd298f",
"form_id": "000000000000000000000000",
"field_name": "opthomalagist",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad0cd0ab414d09ffd2993",
"name": "Pharmacy",
"attributes": {"label": "x Contains "},
"field": {
"id": "656ad0cd0ab414d09ffd2993",
"form_id": "000000000000000000000000",
"field_name": "Pharmacy",
"field_value": ["Yes", "No"],
"field_type": "radioButton",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
}
],
"option": "x Contains "
}
],
"option": "x == Eye problem"
},
{
"id": "656ad0a40ab414d09ffd2990",
"name": "ENT",
"attributes": {"label": "x == Ear pain"},
"field": {
"id": "656ad0a40ab414d09ffd2990",
"form_id": "000000000000000000000000",
"field_name": "ENT",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad0cd0ab414d09ffd2993",
"name": "Pharmacy",
"attributes": {"label": "x Contains "},
"field": {
"id": "656ad0cd0ab414d09ffd2993",
"form_id": "000000000000000000000000",
"field_name": "Pharmacy",
"field_value": ["Yes", "No"],
"field_type": "radioButton",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
}
],
"option": "x Contains "
}
],
"option": "x == Ear pain"
},
{
"id": "656ad0ae0ab414d09ffd2991",
"name": "Dentist",
"attributes": {"label": "x == tooth ache"},
"field": {
"id": "656ad0ae0ab414d09ffd2991",
"form_id": "000000000000000000000000",
"field_name": "Dentist",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad0cd0ab414d09ffd2993",
"name": "Pharmacy",
"attributes": {"label": "x Contains "},
"field": {
"id": "656ad0cd0ab414d09ffd2993",
"form_id": "000000000000000000000000",
"field_name": "Pharmacy",
"field_value": ["Yes", "No"],
"field_type": "radioButton",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": [
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
},
{
"id": "656ad10d0ab414d09ffd2995",
"name": "Medicine usage description",
"attributes": {"label": "x == Yes"},
"field": {
"id": "656ad10d0ab414d09ffd2995",
"form_id": "000000000000000000000000",
"field_name": "Medicine usage description",
"field_value": [],
"field_type": "textBox",
"field_use_type": "Analytical",
"action_enabled": true,
"source_form_id": "000000000000000000000000"
},
"children": null,
"option": "x == Yes"
}
],
"option": "x Contains "
}
],
"option": "x == tooth ache"
}
]
}
]
}
};
Map? formField = {};
void main(){
initForm(formFields);
}
initForm(formFields) {
var fieldName = formFields['tree']['field']['field_name'];
var fieldValue = formFields['tree']['field']['field_value'];
var fieldType = formFields['tree']['field']['field_type'];
var children = formFields['tree']['children'];
print(children);
children = null;
formField![fieldName] = fieldValue;
formField!['field_type'] = fieldType;
formField!['children'] = children;
print(formField);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment