Explicit Type Casting for Route Assignments
naveeez10 opened this issue · comments
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
@naveeez10 This should work just fine
final PageRouteInfo route = loggedIn ? RouteA() : RouteB();
This's dart specification, not related to auto_route, any sub-type can be assigned to it's parent