I want new (fresh) flutter page widget every time I open it

Issue

When I leave a page widget and come back to it later, it retains the previous info on the previous session. I would like to create a fresh page widget from scratch every time I opened it. How do I implement this?

Solution

Putting the main data of the widget in the widget declaration works. I suppose the problem was the scope of the data used. If outside the widget declaration, the data would basically be global and would be the same every time the widget is navigated to.

Answered By – 0xba1

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *