pageRouteBuilder property

PageRouteFactory? pageRouteBuilder

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

A PageRoute represents the page in a Navigator, so that it can correctly animate between pages, and to represent the "return value" of a route (e.g. which button a user selected in a modal dialog).

This callback can be used, for example, to specify that a MaterialPageRoute or a CupertinoPageRoute should be used for building page transitions.

The PageRouteFactory type is generic, meaning the provided function must itself be generic. For example (with special emphasis on the <T> at the start of the closure):

pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) => PageRouteBuilder<T>(
  settings: settings,
  pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) => builder(context),


final PageRouteFactory? pageRouteBuilder;