getVelocity method

Velocity getVelocity()

Computes the velocity of the pointer at the time of the last provided data point.

This can be expensive. Only call this when you need the velocity.

Returns if there is no data from which to compute an estimate or if the estimated velocity is zero.


Velocity getVelocity() {
  final VelocityEstimate? estimate = getVelocityEstimate();
  if (estimate == null || estimate.pixelsPerSecond == {
  return Velocity(pixelsPerSecond: estimate.pixelsPerSecond);