getNavigator method

GlobalKey<NavigatorState> getNavigator({
  1. bool forceGlobal = false,
})

Returns navigator key based on current navigation state

Implementation

GlobalKey<NavigatorState> getNavigator({bool forceGlobal = false}) {
  if (isInGlobalStack() || forceGlobal) {
    return globalNavigatorKey;
  }

  // otherwise return navigator key for current tab
  return currentTabKeys[currentTab]!;
}