position property Null safety

ScrollPosition position

Returns the attached ScrollPosition, from which the actual scroll offset of the ScrollView can be obtained.

Calling this is only valid when only a single position is attached.

Implementation

ScrollPosition get position {
  assert(_positions.isNotEmpty, 'ScrollController not attached to any scroll views.');
  assert(_positions.length == 1, 'ScrollController attached to multiple scroll views.');
  return _positions.single;
}