Basically I want to collect my API data in an array AND add new data to my array every time I'm calling my API, then use map function to construct my dynamic row...I hope you understood my problem.
My code, try to construct dynamic row by collecting data in an Array
Future<void> GetTestFee() async {
var jsonResponse;
if (encTestId.isNotEmpty) {
var response = await http.post(
Uri.parse("http://getrbi.in/api/agtyi/GetTestFee"),
body: ({
'EncPartnerId': encLabId,
'EncTestId': encTestId,
}));
if (response.statusCode == 200) {
print("Correct");
print(response.body);
jsonResponse = json.decode(response.body.toString());
print(jsonResponse);
getTestFeeObj=GetTestFeeMap.fromJson(jsonResponse);
} else {
throw Exception("Faild to fetch");
}
} else {
throw Exception("Faild to fetch");
}
//throw Exception("Faild to fetch");
return GetTestFee();
}
JSON resresponse
{
"EncPartnerId": "LEuT1eIlpLiuiiyAAkZme3wpQ==",
"EncTestId": "U4exk+vfMGrn7cjNUa/kji==",
"Fee": "100",
"DiscountedFee": "80",
"BookingFee": "50"
}