popAllHistory method

void popAllHistory(
  1. GlobalKey<NavigatorState> navigationKey
)

Implementation

void popAllHistory(GlobalKey<NavigatorState> navigationKey) {
  final bool canPop = navigationKey.currentState?.canPop() == true;
  if (canPop) {
    while (navigationKey.currentState?.canPop() == true) {
      navigationKey.currentState!.pop();
    }
  }
}