velocity method

double velocity({
  1. double accuracy = 0.0,
})

Calculates the velocity along this line segment.

accuracy The accuracy for calculating the length of the curve. Returns the velocity, or 0.0 if start and end timestamps are the same.

Implementation

double velocity({double accuracy = 0.0}) => start.timestamp != end.timestamp
    ? length(accuracy: accuracy) / (end.timestamp - start.timestamp)
    : 0.0;