popFor<T> abstract method

void popFor<T>(
  1. BuildContext context,
  2. int numberOfPagesToPop, {
  3. required Widget currentPage,
  4. T? popResult,
})

You can reset the flow, eg. go back to the first Participator page, or the Initiator page with popFor.

popFor guarantees that you will never pop beyond the Initiator page.

// Pop just 2 pages while returning true as the result to those two pages.
dynamicRoutesNavigator.popFor(context, 2, true);

// This pops until the first participator page.
final currentPageIndex = dynamicRoutesNavigator.getCurrentPageIndex();
dynamicRoutesNavigator.popFor(context, currentPageIndex);

// Add + 1 to currentPageIndex or just use double.infinity to pop to the Initiator page.
dynamicRoutesNavigator.popFor(context, currentPageIndex);
dynamicRoutesNavigator.popFor(context, double.infinity);

Implementation

void popFor<T>(BuildContext context, int numberOfPagesToPop,
    {required Widget currentPage, T? popResult});