PageScrollPosition class abstract interface

Represents a position in a scrollable or paginated collection.

This abstract interface provides a common abstraction for different types of scrolling strategies, including:

  • Key-set based scrolling (cursor-based)
  • Offset-based scrolling (index-based)

Usage Example

// Key-set initial position
final initialKeyset = ScrollPosition.keySet();

// Key-set forward scrolling
final nextPage = ScrollPosition.forward({"id": 123});

// Offset-based scrolling
final offsetPos = ScrollPosition.offSet(10);

Design Notes

  • Implementations must provide isInitial to indicate whether the scroll position represents the start of the collection.
  • Static factory methods provide a convenient way to create commonly used positions.
  • Suitable for repository queries, API pagination, or UI scroll tracking.

See Also

Mixed-in types
Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

equalizedProperties() → List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
inherited
isInitial() → bool
Returns true if this scroll position represents the initial position of the collection or dataset.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

backward(Map<String, Object> keys) → KeysetPageScrollPosition
Creates a key-set scroll position moving backward from the given keys.
forward(Map<String, Object> keys) → KeysetPageScrollPosition
Creates a key-set scroll position moving forward from the given keys.
keySet() → KeysetPageScrollPosition
Creates a key-set scroll position at the initial position.
offSet([int? offset]) → OffsetPageScrollPosition
Creates an offset-based scroll position at the given offset.