GetRouterOutlet.pickPages constructor

GetRouterOutlet.pickPages({
  1. Key? key,
  2. Widget emptyWidget(
    1. GetDelegate delegate
    )?,
  3. GetPage emptyPage(
    1. GetDelegate delegate
    )?,
  4. required Iterable<GetPage> pickPages(
    1. RouteDecoder currentNavStack
    ),
  5. void onDidRemovePage(
    1. Page
    )?,
  6. String? restorationScopeId,
  7. GlobalKey<NavigatorState>? navigatorKey,
  8. GetDelegate? delegate,
})

Implementation

GetRouterOutlet.pickPages({
  super.key,
  Widget Function(GetDelegate delegate)? emptyWidget,
  GetPage Function(GetDelegate delegate)? emptyPage,
  required super.pickPages,
  void Function(Page<dynamic>)? onDidRemovePage,
  String? restorationScopeId,
  GlobalKey<NavigatorState>? navigatorKey,
  GetDelegate? delegate,
}) : super(
       pageBuilder: (context, rDelegate, pages) {
         final pageRes = <GetPage?>[
           ...?pages,
           if (pages == null || pages.isEmpty) emptyPage?.call(rDelegate),
         ].whereType<GetPage>();

         if (pageRes.isNotEmpty) {
           return InheritedNavigator(
             navigatorKey:
                 navigatorKey ?? Get.rootController.rootDelegate.navigatorKey,
             child: GetNavigator(
               restorationScopeId: restorationScopeId,
               onDidRemovePage: onDidRemovePage,
               pages: pageRes.toList(),
               key: navigatorKey,
             ),
           );
         }
         return (emptyWidget?.call(rDelegate) ?? const SizedBox.shrink());
       },
       delegate: delegate ?? Get.rootController.rootDelegate,
     );