auto_route_library
auto_route_library copied to clipboard
Explicit Type Casting for Route Assignments
Lets say i have a condition to route to RouteA
if a boolean value loggedIn
is true, otherwise we want to route to RouteB
.
I need to define it as :
final PageRouteInfo route = loggedIn ? RouteA() : RouteB();
But this doesn't work. We need to explicitly typecase it as follows.
final PageRouteInfo route = (loggedIn ? RouteA() : RouteB()) as PageRouteInfo;
I think this should be handled and there shouldn't be a need for explicit typecast