pushRoute<T extends Object?> method

Future<T?> pushRoute<T extends Object?>(
  1. Widget route, {
  2. RouteSettings? settings,
  3. bool maintainState = true,
  4. bool fullscreenDialog = false,
  5. bool allowSnapshotting = true,
})

Pushes a new route onto the navigator stack using the provided route widget.

The settings parameter can be used to customize the route settings. The maintainState parameter determines whether the state of the previous route should be preserved. The fullscreenDialog parameter specifies whether the new route is a fullscreen dialog. The allowSnapshotting parameter determines whether the route can be snapshot or not.

Returns a Future that resolves to the value returned by the pushed route.

Implementation

Future<T?> pushRoute<T extends Object?>(
  Widget route, {
  RouteSettings? settings,
  bool maintainState = true,
  bool fullscreenDialog = false,
  bool allowSnapshotting = true,
}) {
  return Navigator.of(this).push<T>(
    MaterialPageRoute<T>(
      builder: (context) => route,
      settings: settings,
      maintainState: maintainState,
      fullscreenDialog: fullscreenDialog,
      allowSnapshotting: allowSnapshotting,
    ),
  );
}