The title pretty much explains what I want to do. I have an app where the init state has async methods to be called. There are also buttons in the build which when pressed execute async methods (api calls).
The problem is that if I navigate to a new screen before the previous screen has completed fully loading, the app shows ambigious behaviour like not loading the next screens completely or crashing altogether.
My question is that what happens to async methods of the previous screen when you navigate to a new screen before they finished executing?
Is there a way to pause/cancel the execution of those async methods when you navigate to a new screen and resume/reload when you come back to that screen?
OR
Is there a way to only navigate to the new screen when the previous screen has completed fully loading.
I apologize if there seem knowledge gaps in my question. TIA