I need to pass 2 arguments in ChartSampleData()
but I'm having trouble because it says that
List<ChartSampleData> _list = [];
_list.add(ChartSampleData.fromMap(
'${formattedDate.toString()}', redeemedToday[index].total));
the argument type 'String' can't be assigned to the parameter type 'Map<String,dynamic>'
here's my class
i tried doing these,
Code:
class ChartSampleData {
ChartSampleData(this.xValue, this.yValue);
ChartSampleData.fromMap(
Map<String, dynamic> dataMap0, Map<String, dynamic> dataMap1)
: xValue = dataMap0['x'],
yValue = dataMap1['y'];
final dynamic xValue;
final dynamic yValue;
}
ChartSampleData.fromMap
specifies that it needs aMap<String, dynamic>
as an input and you are giving it'${formattedDate.toString()}'
which is a string. – Abion47