popUntilInitiatorPage<T> method

  1. @override
void popUntilInitiatorPage<T>(
  1. BuildContext context, {
  2. T? popResult,
})
override

Pops the pages until the current navigator. Use this in the lastPageCallback to pop until the initiator page.

Implementation

@override
void popUntilInitiatorPage<T>(BuildContext context, {T? popResult}) async {
  assert(
      _isStackLoaded,
      "the initializeRoutes() method should be called first before this can "
      "be used.");

  final bool canPop = _widget != null;
  if (!canPop) {
    debugPrint(
        "There is nothing to pop; pushFirst() has not yet been called");
    return;
  }

  final _currentPage = _getCurrentPageDLLData(_widget);
  final pagesLeftUntilFirstPage =
      _currentPage.getTraversalSteps(PageDLLTraversalDirection.left);

  popFor(context, pagesLeftUntilFirstPage + 1,
      currentPage: _currentPage.widget, popResult: popResult);
}