maintainState property

  1. @override
bool maintainState

Whether the route should remain in memory when it is inactive.

If this is true, then the route is maintained, so that any futures it is holding from the next route will properly resolve when the next route pops. If this is not necessary, this can be set to false to allow the framework to entirely discard the route's widget hierarchy when it is not visible.

Setting maintainState to false does not guarantee that the route will be discarded. For instance, it will not be discarded if it is still visible because the next above it is not opaque (e.g. it is a popup dialog).

If this getter would ever start returning a different value, the changedInternalState should be invoked so that the change can take effect.

See also:


bool get maintainState => true;