Reputation: 117
Two screens navigate to the second screen and run init state and pop to screen one and again navigate to second screen I don't want to run init again I want to run init for the first time only when the app open
Upvotes: 0
Views: 688
Reputation: 1496
initState will get call every time as per statefull widget lifecycle because when you pop the screen at that time dispose methode get executes and all the saved state will get disposed.
You can create util class and keep one variable. If that variable is have a specific value then do not execute the business logic in initState otherwise execute the your desired business logic.
Upvotes: 1