pushReplacement<T> method

Future<T?> pushReplacement<T>(
  1. String location, {
  2. required RouteMatchList base,
  3. Object? extra,
})

Removes the top-most route match from base and pushes the location as a new route on top.

Implementation

Future<T?> pushReplacement<T>(String location,
    {required RouteMatchList base, Object? extra}) {
  final Completer<T?> completer = Completer<T?>();
  _setValue(
    location,
    RouteInformationState<T>(
      extra: extra,
      baseRouteMatchList: base,
      completer: completer,
      type: NavigatingType.pushReplacement,
    ),
  );
  return completer.future;
}