moveTo method

Future<void> moveTo (double to, { Duration duration, Curve curve, bool clamp })

Calls jumpTo if duration is null or Duration.zero, otherwise animateTo is called.

If animateTo is called then curve defaults to Curves.ease. The clamp parameter is ignored by this stub implementation but subclasses like ScrollPosition handle it by adjusting to to prevent over or underscroll.

Implementation

Future<void> moveTo(double to, {
  Duration duration,
  Curve curve,
  bool clamp,
}) {
  assert(to != null);
  if (duration == null || duration == Duration.zero) {
    jumpTo(to);
    return Future<void>.value();
  } else {
    return animateTo(to, duration: duration, curve: curve ?? Curves.ease);
  }
}