pushRouteAndRemoveUntil<T extends Object?> method
Future<T?>
pushRouteAndRemoveUntil<T extends Object?>(
- Widget route,
- RoutePredicate predicate, {
- RouteSettings? settings,
- bool maintainState = true,
- bool fullscreenDialog = false,
- bool allowSnapshotting = true,
Pushes a new route onto the navigator stack and removes all previous
routes until the predicate returns true.
The route parameter specifies the widget for the new route to push.
The predicate parameter determines the condition for stopping the
removal of routes.
The settings parameter can be used to customize the route settings.
The maintainState parameter determines whether the state of the new
route should be preserved.
The fullscreenDialog parameter specifies whether the new route is a
fullscreen dialog.
The allowSnapshotting parameter determines whether the route can be
snapshot or not.
Returns a Future that resolves to the value returned by the pushed route.
Implementation
Future<T?> pushRouteAndRemoveUntil<T extends Object?>(
Widget route,
RoutePredicate predicate, {
RouteSettings? settings,
bool maintainState = true,
bool fullscreenDialog = false,
bool allowSnapshotting = true,
}) {
return Navigator.of(this).pushAndRemoveUntil<T>(
MaterialPageRoute<T>(
builder: (context) => route,
settings: settings,
maintainState: maintainState,
fullscreenDialog: fullscreenDialog,
allowSnapshotting: allowSnapshotting,
),
predicate,
);
}