PageStorageKey<T> class

A ValueKey that defines where PageStorage values will be saved.

Scrollables (ScrollPositions really) use PageStorage to save their scroll offset. Each time a scroll completes, the scrollable's page storage is updated.

PageStorage is used to save and restore values that can outlive the widget. The values are stored in a per-route Map whose keys are defined by the PageStorageKeys for the widget and its ancestors. To make it possible for a saved value to be found when a widget is recreated, the key's values must not be objects whose identity will change each time the widget is created.

For example, to ensure that the scroll offsets for the scrollable within each MyScrollableTabView below are restored when the TabBarView is recreated, we've specified PageStorageKeys whose values are the tabs' string labels.

  children: tab) {
      key: PageStorageKey<String>(tab.text), // like 'Tab 1'
      tab: tab,


PageStorageKey(T value)
Creates a ValueKey that defines where PageStorage values will be saved.


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
value → T
The value to which this key delegates its operator==
final, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.


operator ==(dynamic other) bool
The equality operator. [...]