popUntilNamedRoute method

void popUntilNamedRoute(
  1. String routeName
)

Pops until a specific route is reached.

routeName is the name of the route to pop until.

Implementation

void popUntilNamedRoute(String routeName) {
  try {
    if (context != null) {
      Navigator.popUntil(context!, ModalRoute.withName(routeName));
    } else if (navigatorKey != null) {
      navigatorKey!.currentState!.popUntil(ModalRoute.withName(routeName));
    }
  } catch (e) {
    print('Error in popUntilNamedRoute: $e');
  }
}