addAllowedPointer method Null safety

  1. @override
void addAllowedPointer(
  1. PointerDownEvent event
)
override

Registers a new pointer that's been checked to be allowed by this gesture recognizer.

Subclasses of GestureRecognizer are supposed to override this method instead of addPointer because addPointer will be called for each pointer being added while addAllowedPointer is only called for pointers that are allowed by this recognizer.

Implementation

@override
void addAllowedPointer(PointerDownEvent event) {
  super.addAllowedPointer(event);
  _velocityTrackers[event.pointer] = VelocityTracker.withKind(event.kind);
  if (_state == _ScaleState.ready) {
    _state = _ScaleState.possible;
    _initialSpan = 0.0;
    _currentSpan = 0.0;
    _initialHorizontalSpan = 0.0;
    _currentHorizontalSpan = 0.0;
    _initialVerticalSpan = 0.0;
    _currentVerticalSpan = 0.0;
  }
}