getVisualPages method

Iterable<GetPage> getVisualPages(
  1. RouteDecoder? currentHistory
)

gets the visual pages from the current _activePages entry

visual pages must have GetPage.participatesInRootNavigator set to true

Implementation

Iterable<GetPage> getVisualPages(RouteDecoder? currentHistory) {
  if (currentHistory == null) return const [];

  final treeBranch = currentHistory.currentTreeBranch;
  final hasExplicitParticipants = treeBranch.any(
    (r) => r.participatesInRootNavigator != null,
  );

  if (!hasExplicitParticipants) {
    //default behavior, all routes participate in root navigator
    return _activePages.map((e) => e.route!);
  } else {
    //user specified at least one participatesInRootNavigator
    return treeBranch.where(
      (element) => element.participatesInRootNavigator == true,
    );
  }
}