jumpTo method

void jumpTo(
  1. double value
)

Jumps the scroll position immediately to value in pixels.

Example

final scrollController = ScrollController();
scrollController.jumpTo(100.0);

Implementation

void jumpTo(double value) {
  if (_attachedElement == null) return;

  // update scroll offset
  _offset = value;

  // update scroll position
  if (direction == ScrollDirection.vertical) {
    _attachedElement!.scrollTop = value;
  } else {
    _attachedElement!.scrollLeft = value;
  }

  // notify listeners of scroll position changes
  notifyListeners();
}