I have a json file as shown below. When user choose amount and maturity I need to show a maturity value.
Example: If user choose amount=500 and maturity= 24M. I need to show the number 6.
How to filter Map in Flutter ?
Here is what I did so far:
My json file:
{
“AMOUNT”:[
{
"500":{
“MATURITY":[
{
"12M”:”4”
},
{
"24M”:”6”
},
{
"36M”:”8”
},
{
"48M”:”10”
},
{
"60M”:”12”
}
]
},
“1000":{
“MATURITY":[
{
"12M”:”8”
},
{
"24M”:”12”
},
{
"36M”:”16”
},
{
"48M”:”20”
},
{
"60M”:”24”
}
]
}
}
]
}
Json Load:
// Test part trying to load json into basic map...
String jsonFastMaturity = await rootBundle.loadString("assets/myfile.json");
Map _mapFastMaturity = jsonDecode(jsonFastMaturity);
List _tmpFastMaturity = _mapFastMaturity[“AMOUNT”];