moveTo method Null safety

  1. @override
Future<void> moveTo(
  1. double to,
  2. {Duration? duration,
  3. Curve? curve,
  4. bool? clamp = true}

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

If clamp is true (the default) then to is adjusted to prevent over or underscroll.

If animateTo is called then curve defaults to Curves.ease.


Future<void> moveTo(
  double to, {
  Duration? duration,
  Curve? curve,
  bool? clamp = true,
}) {
  assert(to != null);
  assert(clamp != null);

  if (clamp!)
    to = to.clamp(minScrollExtent, maxScrollExtent);

  return super.moveTo(to, duration: duration, curve: curve);