MaterialPageRoute<T> constructor Null safety

MaterialPageRoute<T>(
  1. {required WidgetBuilder builder,
  2. RouteSettings? settings,
  3. bool maintainState = true,
  4. bool fullscreenDialog = false,
  5. bool preferRasterization = true}
)

Construct a MaterialPageRoute whose contents are defined by builder.

The values of builder, maintainState, and PageRoute.fullscreenDialog must not be null.

Implementation

MaterialPageRoute({
  required this.builder,
  super.settings,
  this.maintainState = true,
  super.fullscreenDialog,
  super.preferRasterization = true,
}) : assert(builder != null),
     assert(maintainState != null),
     assert(fullscreenDialog != null) {
  assert(opaque);
}