replaceWith<T> method

Future<T?>? replaceWith<T>(
  1. String routeName, {
  2. dynamic arguments,
  3. int? id,
  4. bool preventDuplicates = true,
  5. Map<String, String>? parameters,
  6. RouteTransitionsBuilder? transition,
})

Replaces the current route with the routeName

id is for when you are using nested navigation, as explained in documentation.

preventDuplicates will prevent you from pushing a route that you already in, if you want to push anyway, set to false.

Implementation

Future<T?>? replaceWith<T>(
  String routeName, {
  dynamic arguments,
  int? id,
  bool preventDuplicates = true,
  Map<String, String>? parameters,
  RouteTransitionsBuilder? transition,
}) {
  return G.Get.offNamed<T?>(
    routeName,
    arguments: transition != null
        ? {'arguments': arguments, 'transition': transition}
        : arguments,
    id: id,
    preventDuplicates: preventDuplicates,
    parameters: parameters,
  );
}