scrollIntoView method Null safety

void scrollIntoView(
  1. [ScrollAlignment? alignment]

Scrolls this element into view.

Only one of the alignment options may be specified at a time.

If no options are specified then this will attempt to scroll the minimum amount needed to bring the element into view.

Note that alignCenter is currently only supported on WebKit platforms. If alignCenter is specified but not supported then this will fall back to alignTop.

See also:


void scrollIntoView([ScrollAlignment? alignment]) {
  var hasScrollIntoViewIfNeeded = true;
  hasScrollIntoViewIfNeeded =
      JS('bool', '!!(#.scrollIntoViewIfNeeded)', this);
  if (alignment == ScrollAlignment.TOP) {
  } else if (alignment == ScrollAlignment.BOTTOM) {
  } else if (hasScrollIntoViewIfNeeded) {
    // TODO(srujzs): This method shouldn't be calling out to
    // `scrollIntoViewIfNeeded`. Remove this and make `scrollIntoView` match
    // the browser definition. If you intend to use `scrollIntoViewIfNeeded`,
    // use the `Element.scrollIntoViewIfNeeded` method.
    if (alignment == ScrollAlignment.CENTER) {
    } else {
  } else {