hitTestLine function

bool hitTestLine(
  1. Offset point,
  2. Offset start,
  3. Offset end,
  4. double thickness,
)

Returns true if point is within thickness of the segment start-end.

Implementation

bool hitTestLine(Offset point, Offset start, Offset end, double thickness) {
  final baseThickness = clampNonNegativeFinite(thickness);
  final distance = distancePointToSegment(point, start, end);
  return distance <= baseThickness / 2;
}