'Flutter keep current screen on resume [duplicate]

In my app I have multiple screens, like: Login, Home and 2ndScreen. If I go to 2ndScreen, then minimize app and then open it again, it shows Home screen instead of 2ndScreen. So my question is: How can I keep current app screen after app resume?



Solution 1:[1]

You might be looking for the app state restoration.

You can use RestorationManager which is the class that is responsible for handling all the state restoration work.

Below articles can help you to get started with it.

Introduction to State Restoration in Flutter

Flutter State restoration | Restore Scrollviews and Textfields

EDIT

There's an answer for a similar question.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1