replace<T> method

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

Replaces the top-most route match from base with the location.

Implementation

Future<T?> replace<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.replace,
    ),
  );
  return completer.future;
}