hitTest method

bool hitTest(
  1. FlSpot spot,
  2. Offset touched,
  3. Offset center,
  4. double extraThreshold,
)

Used to implement touch behaviour of this dot, for example, it behaves like a square of getSize Check FlDotCirclePainter.hitTest for an example of an implementation

Implementation

bool hitTest(
  FlSpot spot,
  Offset touched,
  Offset center,
  double extraThreshold,
) {
  final size = getSize(spot);
  final spotRect = Rect.fromCenter(
    center: center,
    width: size.width,
    height: size.height,
  );
  final thresholdRect = spotRect.inflate(extraThreshold);
  return thresholdRect.contains(touched);
}