Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#464 turned out to not be very good in terms of maintanability and honestly is just too much refactoring work this far along. I've made this PR with a couple of commits from that branch + a different approach. Instead I decoupled AccountsStore from its saving to preferences functionality, and moved that out of the class to be handled elsewhere listening to the store for changes. I fiddled around with the concept of passing new accounts stores whenever accounts are selected, but it turns out the BuildContext passed to any routes you create is not the BuildContext you pass to Navigator.of(), it's the build context on which the Navigator itself is created (in this case within the top level MaterialApp unfortunately) so overriding the AccountsStore in the context. So now changing users just changes the "default account" which is already used all over the app. I think trying to muddle with individualizing accounts in routes (or even in the different stores) is going to be a nightmare refactoring job but at least I know that for a fact now.