I have a problem with implementing multiple accounts in flutter app.
When the app is first opened, multiple network calls are made to get account related data. Those calls are usually made in initState of each widget using BLoC pattern. After await-ing on those data, UI or some other parts of app is updated.
The problem is, when user tries to switch to another account, app navigates user to the root page, so all the loading of required data for this account would happen again. But since some calls from previous account might still be ongoing and finish only after user switches to another account, I get multiple issues in application, like rendering UI with data that belongs to previous account.
I know I can dispose all those streams, so no UI is updated incorrectly regardless of the response. But, I was wondering if there is a way to kill all the ongoing requests, since app doesn't care about the response after the account is changed. In other words, I need the effect of restarting the app, but without actually restarting it. Is there any way to achieve that?