ChartInteractionResult constructor

const ChartInteractionResult({
  1. ChartDataPoint? point,
  2. PieData? segment,
  3. int? datasetIndex,
  4. int? elementIndex,
  5. bool isHit = false,
})

Creates a chart interaction result.

isHit defaults to false. Set to true when an element is found. Either point or segment should be provided (not both).

Implementation

const ChartInteractionResult({
  this.point,
  this.segment,
  this.datasetIndex,
  this.elementIndex,
  this.isHit = false,
}) : assert(
       point == null || segment == null,
       'Cannot have both point and segment',
     ),
     assert(
       !isHit || (point != null || segment != null),
       'isHit true requires point or segment',
     ),
     assert(
       !isHit || datasetIndex != null,
       'isHit true requires datasetIndex',
     ),
     assert(
       !isHit || elementIndex != null,
       'isHit true requires elementIndex',
     );