I have a mobile frontend app for a web service, requiring a user login.
Login tokens can expire or invalidate at any moment returning a particular http error code.
I'm not sure how I should handle this in Flutter.
I could add a try-catch to all web calls but it sounds like a lot of redundant typing and copy-pasting.
I'm thinking about registering a listener for the API service class but how do I get a flutter context in the callback for route management?
I've checked this question. Mine is not about how to check for errors or log out the user, but rather how to centralize/convert the existing app?
Another question looks like my case but the only answer is not accepted after many months. Makes me doubt if that's how it should be done.
Any ideas appreciated