isAllDataPointsEmpty static method

bool isAllDataPointsEmpty(
  1. List<ChartDataSet> dataSets
)

Returns true if dataSets is empty or every data point has both x and y equal to zero (no meaningful data to display).

Use this to show an empty state widget instead of rendering the chart when there is no data to display.

Implementation

static bool isAllDataPointsEmpty(List<ChartDataSet> dataSets) {
  if (dataSets.isEmpty) return true;
  return dataSets.every((ds) => ds.dataPoint.x == 0 && ds.dataPoint.y == 0);
}