Computes a pointer velocity based on data from PointerMove events.
The input data is provided by calling addPosition(). Adding data is cheap.
To obtain a velocity, call getVelocity(). This will compute the velocity based on the data added so far. Only call this when you need to use the velocity, as it is comparatively expensive.
The quality of the velocity estimation will be better if more data points have been received.
Constants
- kAssumePointerMoveStoppedTime → Duration
-
The maximum length of time between two move events to allow before assuming the pointer stopped.
const Duration(milliseconds: 40)
Constructors
- VelocityTracker()
-
Creates a velocity tracker.
Properties
- hashCode → int
-
Get a hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
addPosition(
Duration timeStamp, Point position) → void -
Add a given position corresponding to a specific time.
-
getVelocity(
) → Velocity -
Computes the velocity of the pointer at the time of the last provided data point.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited