CenterDataSource<PageKey, Value> class abstract

A DataSource specifically designed for CenterPagingList.

Unlike the standard DataSource, this manages three separate segments of data: Prepend, Center, and Append. This allows for seamless bi-directional scrolling using CustomScrollView's center key feature.

The Center segment is the initial anchor point of the list, and:

  • Prepend segment items appear above the Center (in reverse scroll direction)
  • Append segment items appear below the Center

Constructors

CenterDataSource({Set<LoadErrorPolicy> errorPolicy = const {}})
Creates a CenterDataSource. Use errorPolicy to define which errors should be ignored visually.

Properties

centerKey GlobalKey<State<StatefulWidget>>
The key used to anchor the CustomScrollView at the Center segment.
final
errorPolicy Set<LoadErrorPolicy>
Defines the error handling policy for load operations. By default, all errors are shown in the UI.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
notifier → CenterPageManager<PageKey, Value>
The underlying state manager for the data source.
no setter
onLoadFinished ↔ void Function(LoadAction<PageKey> action, LoadResult<PageKey, Value> result)?
A callback invoked after every load operation completes, providing the LoadResult. Useful for analytics or showing temporary error messages.
getter/setter pair
onLoadStarted ↔ void Function(LoadAction<PageKey> action)?
A callback that is invoked just before a load operation begins. It provides the LoadAction that is about to be executed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Registers a callback to be invoked when the data or loading state changes.
append() Future<void>
Triggers an append operation to load data after the current items.
dispose() → void
Releases the resources used by this CenterDataSource.
insertItem(int index, Value item) → void
Inserts an item at the specified index and notifies listeners.
load(LoadAction<PageKey> action) Future<LoadResult<PageKey, Value>>
Loads a page of data based on the specified LoadAction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prepend() Future<void>
Triggers a prepend operation to load data before the current items.
refresh() Future<void>
Triggers a full refresh of the data, discarding all segments.
removeItem(int index) → void
Removes a single item at the specified index and notifies listeners.
removeItems(bool test(int index, Value item)) → void
Removes all items that satisfy the given test and notifies listeners.
removeListener(VoidCallback listener) → void
Removes a previously registered callback.
toString() String
A string representation of this object.
inherited
updateItem(int index, Value update(Value item)) → void
Updates a single item in the list at the specified index.
updateItems(Value update(int index, Value item)) → void
Updates all items currently in the list and notifies listeners.

Operators

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