pushReplacement<T extends Object?> method
Future<T>
pushReplacement<T extends Object?>(
- Widget screen, {
- RouteSettings? settings,
- bool maintainState = true,
- bool fullscreenDialog = false,
- dynamic result,
Replaces the current route with a new screen.
Allows customization of the route via settings, maintainState, and
fullscreenDialog. rootNavigator determines whether to push the route
onto the root navigator or the nearest Navigator ancestor.
Optionally returns a result to the previous route.
Returns a Future that completes with the result of the pushed route when it is popped.
Implementation
Future<T> pushReplacement<T extends Object?>(
Widget screen, {
RouteSettings? settings,
bool maintainState = true,
bool fullscreenDialog = false,
bool rootNavigator = false,
dynamic result,
}) async =>
await Navigator.of(
this,
rootNavigator: rootNavigator,
).pushReplacement(
MaterialPageRoute(
builder: (_) => screen,
settings: settings,
maintainState: maintainState,
fullscreenDialog: fullscreenDialog,
),
result: result,
);