Navigator1 or 2?
You define For example Server Exception. On every api call you get response.StatusCode. If it 401 you throw this kind of Exceptions. Actually you can define few Exception types before and according to statuscode you throw specific Exception. If you are using bloc you can define error state and show that specific widget
Or you can just push to the new route
I'm using the auto route
if you're using Navigator 2.0 with go-router , you can redirect the user to such error screen when something goes wrong . or otherwise , what you can do is using a wrapper class to the top of your widget tree .
for example , i ve code like this and when token will expired it must redirect to another page
So, when your Refresh token expires, you'll get a 401 error, right? how about setting up a state where you add an AuthException event to the bloc
I am wondering why you use "TOKEN_REFRESH" inside your .env
Обсуждают сегодня