popGlobalToFirst method

void popGlobalToFirst()

Pops all dialogs bottom sheets and global routes

Implementation

void popGlobalToFirst() {
  popAllDialogsAndBottomSheets();

  final navigator = getNavigator(forceGlobal: true);

  // coverage:ignore-start
  navigator.currentState?.popUntil((route) => route.isFirst);
  // coverage:ignore-end

  navigationStack.replaceStack(
    routeName:
        navigationStack.globalNavigationStack.stack.first.name as RouteType,
    settings: const UIRouteSettings(global: true, uniqueInStack: true),
  );
}