replace<T extends Object> method

  1. @optionalTypeArgs
void replace <T extends Object>(BuildContext context, { @required Route oldRoute, @required Route<T> newRoute })
@optionalTypeArgs

Replaces a route on the navigator that most tightly encloses the given context with a new route.

See also:

  • replaceRouteBelow, which is the same but identifies the route to be removed by reference to the route above it, rather than directly.

Implementation

@optionalTypeArgs
static void replace<T extends Object>(BuildContext context, { @required Route<dynamic> oldRoute, @required Route<T> newRoute }) {
  return Navigator.of(context).replace<T>(oldRoute: oldRoute, newRoute: newRoute);
}