pushReplacement method

Future pushReplacement(
  1. Widget screen, {
  2. RouteSettings? settings,
  3. bool maintainState = true,
  4. bool fullscreenDialog = false,
  5. bool rootNavigator = false,
})

performs a simple Navigator.pushReplacement action with given route

Implementation

Future<dynamic> pushReplacement(
  Widget screen, {
  RouteSettings? settings,
  bool maintainState = true,
  bool fullscreenDialog = false,
  bool rootNavigator = false,
}) async =>
    await Navigator.of(
      this,
      rootNavigator: rootNavigator,
    ).pushReplacement(MaterialPageRoute(
      builder: (_) => screen,
      settings: settings,
      maintainState: maintainState,
      fullscreenDialog: fullscreenDialog,
    ));