scrollToEnd method

Future<void> scrollToEnd({
  1. bool animate = true,
  2. Duration duration = const Duration(milliseconds: 180),
  3. Curve curve = Curves.easeOut,
})

Returns to the end and follows again.

Animates unless animate is false; pass false under reduced motion. Output that grows while the animation runs is followed when it ends.

Implementation

Future<void> scrollToEnd({
  bool animate = true,
  Duration duration = const Duration(milliseconds: 180),
  Curve curve = Curves.easeOut,
}) async {
  _setFollowing(true);
  final position = _position;
  if (position == null) return;
  if (!animate) {
    _jumpToEnd();
    return;
  }
  _returning = true;
  try {
    await position.animateTo(
      position.maxScrollExtent,
      duration: duration,
      curve: curve,
    );
  } finally {
    _returning = false;
    if (!_disposed && keepsEnd) _jumpToEnd();
  }
}