popUntilNamedRoute method

void popUntilNamedRoute({
  1. String? routeName,
  2. Map<String, dynamic>? args,
})

Pops until a specific route is reached.

If a valid BuildContext is provided, this method pops routes from the navigation stack until the specified named route is reached.

Implementation

void popUntilNamedRoute({String? routeName, Map<String,dynamic>? args}) {
  Navigator.popUntil(
    context,
    ModalRoute.withName(routeName!),
  );
}