popCurrent<T> method

  1. @override
void popCurrent<T>(
  1. BuildContext context, {
  2. required Widget currentPage,
  3. T? popResult,
})
override

Pop the current page and all of its sub-routes.

Prefer this over Navigator.of(context).pop for all participators widget.

Implementation

@override
void popCurrent<T>(BuildContext context,
    {required Widget currentPage, T? popResult}) async {
  assert(
      _widget != null,
      "pushFirst() "
      "of the dynamicRoutesInitiator instance should be called before calling "
      "this method on a participator");

  final pageData = _getCurrentPageDLLData(currentPage);

  // If the right-side expression is null, then this is the first page and
  // popping this should destroy the whole navigation state.
  _widget = pageData.previousPage?.widget;

  return _navigationLogicProvider.back(BackArguments(
      context: context,
      currentPage: pageData.widget,
      result: popResult,
      previousPage: _widget));
}