maintainState property

bool maintainState
final

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).

Implementation

final bool maintainState;