pushNamed<T extends Object?> static method
Future<T?>
pushNamed<T extends Object?>(
- BuildContext context,
- String routeName, {
- Object? arguments,
Implementation
static Future<T?> pushNamed<T extends Object?> (
BuildContext context,
String routeName, {
Object? arguments,
}) async{
FxRoute? fxRoute = getRouteFromName(routeName);
if(fxRoute==null)
throw("This route is not implemented");
if(fxRoute.middlewares!=null) {
for (FxMiddleware middleware in fxRoute.middlewares!) {
String redirectedRouteName = await middleware.handle(routeName);
if(redirectedRouteName.compareTo(routeName)!=0){
return pushNamed(context, redirectedRouteName,arguments: arguments);
}
}
}
return Navigator.of(context).pushNamed<T>(routeName, arguments: arguments);
}