startAutoScrollIfNecessary method Null safety

void startAutoScrollIfNecessary(
  1. Rect dragTarget

Starts the auto scroll if the dragTarget is close to the edge.

The scroll starts to scroll the scrollable if the target rect is close to the edge of the scrollable; otherwise, it remains stationary.

If the scrollable is already scrolling, calling this method updates the previous dragTarget to the new value and continues scrolling if necessary.


void startAutoScrollIfNecessary(Rect dragTarget) {
  final Offset deltaToOrigin = _getDeltaToScrollOrigin(scrollable);
  _dragTargetRelatedToScrollOrigin = dragTarget.translate(deltaToOrigin.dx, deltaToOrigin.dy);
  if (_scrolling) {
    // The change will be picked up in the next scroll.
  if (!_scrolling) {