sample method
- Duration sampleTime,
- Duration nextSampleTime,
- HandleEventCallback callback
Dispatch resampled pointer events for the specified sampleTime
by calling callback.
This may dispatch multiple events if position is not the only state that has changed since last sample.
Calling callback must not add or sample events.
Positive value for nextSampleTime allow early processing of
up and removed events. This improves resampling of these events,
which is important for fling animations.
Implementation
void sample(Duration sampleTime, Duration nextSampleTime, HandleEventCallback callback) {
_processPointerEvents(sampleTime);
// Dequeue and sample pointer events until `sampleTime`.
_dequeueAndSampleNonHoverOrMovePointerEventsUntil(sampleTime, nextSampleTime, callback);
// Dispatch resampled pointer location event if tracked.
if (_isTracked) {
_samplePointerPosition(sampleTime, callback);
}
}