pushAndRemoveUntil<T extends Object?> method
Future<T?>
pushAndRemoveUntil<T extends Object?>(
- Widget screen, {
- RouteSettings? settings,
- bool maintainState = true,
- bool fullscreenDialog = false,
- bool routes = false,
Pushes a new screen onto the navigator and removes all previous routes.
Allows customization of the route via settings, maintainState, and
fullscreenDialog. routes determines if all routes should be removed.
if set to true all routes will be removed, if false only the route before the pushed route will be removed.
rootNavigator determines whether to push the route onto the root navigator
or the nearest Navigator ancestor.
Returns a Future that completes with the result of the pushed route when it is popped.
Implementation
Future<T?> pushAndRemoveUntil<T extends Object?>(
Widget screen, {
RouteSettings? settings,
bool maintainState = true,
bool fullscreenDialog = false,
bool routes = false,
bool rootNavigator = false,
}) async =>
await Navigator.of(
this,
rootNavigator: rootNavigator,
).pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => screen,
settings: settings,
maintainState: maintainState,
fullscreenDialog: fullscreenDialog,
),
(Route<dynamic> route) => routes,
);