ScrollPosition constructor

ScrollPosition({@required ScrollPhysics physics, @required ScrollContext context, bool keepScrollOffset: true, ScrollPosition oldPosition, String debugLabel })

Creates an object that determines which portion of the content is visible in a scroll view.

The physics, context, and keepScrollOffset parameters must not be null.

Implementation

ScrollPosition({
  @required this.physics,
  @required this.context,
  this.keepScrollOffset = true,
  ScrollPosition oldPosition,
  this.debugLabel,
}) : assert(physics != null),
     assert(context != null),
     assert(context.vsync != null),
     assert(keepScrollOffset != null) {
  if (oldPosition != null)
    absorb(oldPosition);
  if (keepScrollOffset)
    restoreScrollOffset();
}