isInDirection method

bool isInDirection(
  1. Offset other,
  2. Offset direction, [
  3. int count = 1
])

Implementation

bool isInDirection(Offset other, Offset direction, [int count = 1]) {
  final diff = other - this;
  final normalized = direction / direction.distance;
  return count == 1
      ? diff == normalized
      : diff.distance <= normalized.distance * count;
}