key property

String? key
final

The key to compare with to PAbstractPage.key to decide if the state is applicable to a page in a stack.

It may be more specific than factoryKey and contain parameters that are constant during lifetime of the page, ex: 'ProfilePage_$userId'. This way, when the state with another $userId is applied, the keys won't match, and the page will be re-created with new $userId.

The value of null means that the page is a transient dialog which should not be re-created on re-navigation. It may also be dropped during back-front navigation but this is not guaranteed. This may lead to unexpected results when recovering a state with another null-keyed page at the same position in the stack: such a page will not be replaced. Consider using null here only for prototyping.

Null here may be disallowed in the future after testing real-world needs.

Implementation

final String? key;