jumpToAnchor method
Jumps the scroll position from its current value to the given key, without animation, and without checking if the new key is in range.
Any active animation is canceled. If the user is currently scrolling, that action is canceled.
If this method changes the scroll position, a sequence of start/update/end scroll notifications will be dispatched. No overscroll notifications can be generated by this method.
Immediately after the jump, a ballistic activity is started, in case the key was out of range.
Implementation
@override
/// Jumps the scroll position from its current value to the given key,
/// without animation, and without checking if the new key is in range.
///
/// Any active animation is canceled. If the user is currently scrolling, that
/// action is canceled.
///
/// If this method changes the scroll position, a sequence of start/update/end
/// scroll notifications will be dispatched. No overscroll notifications can
/// be generated by this method.
///
/// Immediately after the jump, a ballistic activity is started, in case the
/// key was out of range.
void jumpToAnchor(GlobalKey anchorKey) {
super.position.ensureVisible(anchorKey.currentContext!.findRenderObject()!);
}