In Flutter, I am trying to make a dependent dropdown with the following json.
I Want the Dropdown to be in this format
First, Independent Dropdown
dataNames
Second, Dependent Dropdown
indexes of the dataSets' children
Third, Dependent Dropdown
select the children of the above drop-down (...hello 1, hello 2... )
[
{
"dataName": "data1",
"dataSets": [
["hello 1", "hello 2", "hello 3"],
["hi 1", "hi 2", "hi 3", "hi 4"]
]
},
{
"dataName": "data2",
"dataSets": [
["2nd 1", "2nd 2", "2nd 3"],
["let 1", "let 2", "let 3", "let 4"]
]
}
]
Here is the first step: parsing the json into a class model and then creating a list of models. second step build the DropdownMenuItem list to be consumed by the DropDownbutton. Create a _currentResultClass variable the first dropdownbutton (level1) selection. Step 3: filter on level 1 dataName and find the model then populate dropdownmenuitems based on a filter by that dataname.