I want to redirect the user to the detail page after clicking on the notification. I did this. But i have a problem with token. My tokens time is very short. If tokens is dead, this application navigate to login page.
I want to After the user clicks on the notification, if the token is dead, I want to redirect to the login page and then open the detail page. how do this with flutter?
From what i see you can use the following package : https://pub.dev/packages/jwt_decoder
This Package basically will let you know if the token is expired or no. If not expired redirect to the normal routes, else go to login page you can get the route name via from constructor and make it optional so that the default login flow is not interrupted.
And now when you get redirected and come to the login page do a login and check if the parameter is not null, if not null it is coming from the notifications page else its a normal login flow.
So you just add a switch case if this is the type you can navigate to specific page based on the type.