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.


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


set offset(ViewportOffset value) {
  assert(value != null);
  if (value == _offset)
  if (attached)
  _offset = value;
  if (attached)
  // 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.