state property Null safety

Object? state
final

The state of the application in the location.

The app can have different states even in the same location. For example, the text inside a TextField or the scroll position in a ScrollView. These widget states can be stored in the state.

On the web, this information is stored in the browser history when the Router reports this route information back to the web engine through the PlatformRouteInformationProvider. The information is then passed back, along with the location, when the user clicks the back or forward buttons.

This information is also serialized and persisted alongside the location for state restoration purposes. During state restoration, the information is made available again to the Router so it can restore its configuration to the previous state.

The state must be serializable.

Implementation

final Object? state;