replace method Null safety
Replaces the top-most page of the page stack with the given URL location
w/ optional query parameters, e.g. /family/f2/person/p1?color=blue.
See also:
Implementation
void replace(String location, {Object? extra}) {
routeInformationParser
.parseRouteInformationWithDependencies(
RouteInformation(location: location, state: extra),
// TODO(chunhtai): avoid accessing the context directly through global key.
// https://github.com/flutter/flutter/issues/99112
_routerDelegate.navigatorKey.currentContext!,
)
.then<void>((RouteMatchList matchList) {
routerDelegate.replace(matchList.matches.last);
});
}