I extract data from the Firebase
to make a list
of FLSpots
and try to assign it to LineChartBarData(spots: )
but the incompatibility doesn't allow it.
static Future<List<FlSpot>> _getDataFromFirestore() async {
...
...
List<FlSpot> spots = listData.asMap().entries.map((e) {
return FlSpot(e.key.toDouble(), e.value);
}).toList();
// print(spots);
return spots;
how can I assign it to avoid the error:
The argument type 'Future<List<FlSpot>>' can't be assigned to the parameter type 'List<FlSpot>'.
when I try
LineChartBarData(
spots: _getDataFromFirestore(),