popInTab method

void popInTab(
  1. AppTabType tab, {
  2. dynamic payload,
  3. bool onlyInternalStack = false,
})

Pops latest route in given tab

if onlyInternalStack is true than only removes route data from navigation stack Navigator state stays the same in this case

Implementation

void popInTab(
  AppTabType tab, {
  dynamic payload,
  bool onlyInternalStack = false,
}) {
  final tabStack = navigationStack.tabNavigationStack.stack[tab]!;

  if (tabStack.length == 1) {
    // preventing close of first page in tab stack
    return;
  }

  if (onlyInternalStack) {
    navigationStack.pop(tab, false);

    return;
  }

  final navigator = currentTabKeys[tab];

  navigationStack.pop(tab, false);

  navigator?.currentState?.pop(payload);
}