moveTo method

Future<void> moveTo(
  1. double to,
  2. {Duration? duration,
  3. Curve? curve,
  4. 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,
}) {
  if (duration == null || duration == Duration.zero) {
    jumpTo(to);
    return Future<void>.value();
  } else {
    return animateTo(to, duration: duration, curve: curve ?? Curves.ease);
  }
}