generator method
Generates the RouteFactory which builds a Route on request.
These routes are built using the NyRouterRoutes addRoute
method.
Implementation
RouteFactory generator() {
return (settings) {
final NyRouterRoute? route = _routeNameMappings[settings.name!];
if (route == null) return null;
ArgumentsWrapper? argsWrapper;
if (settings.arguments is ArgumentsWrapper) {
argsWrapper = settings.arguments as ArgumentsWrapper?;
} else {
argsWrapper = ArgumentsWrapper();
argsWrapper.baseArguments = NyArgument(settings.arguments);
}
if (argsWrapper == null) {
argsWrapper = ArgumentsWrapper();
}
final BaseArguments? baseArgs = argsWrapper.baseArguments;
return PageTransition(
child: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return route.builder(context, baseArgs ?? route.defaultArgs);
}),
type: argsWrapper.pageTransitionType ?? route.pageTransitionType,
settings: settings,
duration:
argsWrapper.transitionDuration ?? this.options.transitionDuration,
);
};
}