onGenerateRoute property

RouteFactory onGenerateRoute
final

The route generator callback used when the app is navigated to a named route.

If this returns null when building the routes to handle the specified initialRoute, then all the routes are discarded and Navigator.defaultRouteName is used instead (/). See initialRoute.

During normal app operation, the onGenerateRoute callback will only be applied to route names pushed by the application, and so should never return null.

This is used if routes does not contain the requested route.

The Navigator is only built if routes are provided (either via home, routes, onGenerateRoute, or onUnknownRoute); if they are not, builder must not be null. If this property is not set, either the routes or home properties must be set, and the pageRouteBuilder must also be set so that the default handler will know what routes and PageRoutes to build.

Implementation

final RouteFactory onGenerateRoute