Closed anoojkv closed 3 months ago
redirect is being rewritten, because it is a bit rigid. I mean, I want to give superpowers to the devs, who can choose a redirect based on a parameter that was received in another lower priority middleware, or according to the stack size, or whatever they want. The old api was limited, and I'm improving that. Maybe this will work for you out of the box (but redirectDelegate will be renamed to "redirect" in the final version)
class LoginMiddleware extends GetMiddleware {
@override
int? get priority => 1;
@override
@override
RouteDecoder? redirectDelegate(RouteDecoder? route) {
if (StorageManager.instance!.getStringValue(
StorageManager.xToken,
) !=
null) {
if (StorageManager.instance!.getBoolValue(
StorageManager.isFirst,
) ==
null) {
return RouteDecoder.fromRoute(AppRoutes.onBoardingPage);
} else {
return RouteDecoder.fromRoute(AppRoutes.mainHomePage);
}
}
return null;
}
}
Firstly,Thank you For a Great Package
Middleware is working well in get: ^4.6.6 but it is not working in the get: ^5.0.0-release-candidate-8. Is any changes in get 5 middleware? Provide a minimum reproduction code for the problem