pushNext<T> method

  1. @override
Future<T?> pushNext<T>(
  1. BuildContext context, {
  2. required Widget currentPage,
})
override

Push the next page in the array

currentPage is needed to obtain the correct previous and next route in the array.

ex. pushNext(context currentPage: widget);

Implementation

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

  final currentPageState = _getCurrentPageDLLData(currentPage);

  if (currentPageState.isLastPage()) {
    _lastPageCallback?.call(context);

    return Future.value(null);
  } else {
    _widget = currentPageState.nextPage!.widget;

    return _navigationLogicProvider
        .next(NextArguments(context: context, nextPage: _widget!));
  }
}