flutter project charts with syncfusion

Job ID: 34232017

Budget: €8 – €30 EUR

Hey, i am currently developing a flutter project and i need some charts. i already started to write the code, but need help with the data.
i receive the data as json from an api call, but when i try to use my data model for the charts, i just receive an empty list.

Future<String> getJsonFromFirebase() async {
var response = await http.post(
Uri.parse('http://tyu-backoffice.com/tradesapi.php'),

),
headers: <String, String>{
'API_KEY': '0B7ZV9B1RDZDG23O9IX48WJCCGDSZN06',
'MANAGER_PASSWORD': 'ank3vpfz'
},
body: jsonEncode(
{"account": 414011, "from": 1653520410, "to": 1658790810}));

return response.body;
}



List<HistoryObject> chartData = [];

Future loadProfitData() async {
final String jsonString = await getJsonFromFirebase();
final dynamic jsonResponse = json.decode(jsonString);
for (Map<String, dynamic> i in jsonResponse)
chartData.add(HistoryObject.fromJson(i));
}

nd inside a futurebuilder:

SfCartesianChart(
primaryXAxis: CategoryAxis(),
// Chart title
title: ChartTitle(text: 'Half yearly sales analysis'),
series: <ChartSeries<HistoryObject, dynamic>>[
LineSeries<HistoryObject, dynamic>(
dataSource: chartData,
xValueMapper: (HistoryObject sales, _) =>
sales.profit,
yValueMapper: (HistoryObject sales, _) =>
sales.ticket,
// Enable data label
dataLabelSettings:
DataLabelSettings(isVisible: true))
]),

api data model attached
Related categories: PHP Dart JSON API Flutter