buildLegendItems method

List<LegendItem>? buildLegendItems(
  1. int index,
  2. LegendItemProvider provider
)

Implementation

List<LegendItem>? buildLegendItems(int index, LegendItemProvider provider) {
  if (isVisibleInLegend) {
    _legendItem = ChartLegendItem(
      text: name ?? _defaultTrendlineName(),
      iconType:
          _toShapeMarkerType(legendIconType, legendItemProvider: provider),
      iconColor: color!,
      iconBorderWidth: 2,
      series: series,
      seriesIndex: series!.index,
      pointIndex: index,
      isToggled: isToggled,
      onTap: _handleLegendItemTapped,
      onRender: _handleLegendItemCreated,
    );
    return <LegendItem>[_legendItem!];
  } else {
    _legendItem = null;
    return null;
  }
}