auto_route_library icon indicating copy to clipboard operation
auto_route_library copied to clipboard

Explicit Type Casting for Route Assignments

Open naveeez10 opened this issue 3 months ago • 1 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 avatar Apr 17 '24 16:04 naveeez10