offset property Null safety

ViewportOffset offset

Which part of the content inside the viewport should be visible.

The ViewportOffset.pixels value determines the scroll offset that the viewport uses to select which part of its content to display. As the user scrolls the viewport, this value changes, which changes the content that is displayed.

Implementation

ViewportOffset get offset => _offset;
void offset=(ViewportOffset value)

Implementation

set offset(ViewportOffset value) {
  assert(value != null);
  if (value == _offset)
    return;
  if (attached)
    _offset.removeListener(markNeedsLayout);
  _offset = value;
  if (attached)
    _offset.addListener(markNeedsLayout);
  // We need to go through layout even if the new offset has the same pixels
  // value as the old offset so that we will apply our viewport and content
  // dimensions.
  markNeedsLayout();
}