Future<Null> scrollTo(double newScrollOffset, { Duration duration, Curve curve: Curves.ease, DragUpdateDetails details })

Scroll this widget to the given scroll offset.

If a non-null duration is provided, the widget will animate to the new scroll offset over the given duration with the given curve.

This function does not accept a zero duration. To jump-scroll to the new offset, do not provide a duration, rather than providing a zero duration.

The returned Future completes when the scrolling animation is complete.

Source

Future<Null> scrollTo(double newScrollOffset, {
  Duration duration,
  Curve curve: Curves.ease,
  DragUpdateDetails details
}) {
  if (newScrollOffset == _scrollOffset)
    return new Future<Null>.value();

  if (duration == null) {
    _stop();
    _setScrollOffset(newScrollOffset, details: details);
    return new Future<Null>.value();
  }

  assert(duration > Duration.ZERO);
  return _animateTo(newScrollOffset, duration, curve);
}