GetDelegate constructor

GetDelegate({
  1. GetPage? notFoundRoute,
  2. List<NavigatorObserver>? navigatorObservers,
  3. TransitionDelegate? transitionDelegate,
  4. PopMode backButtonPopMode = PopMode.history,
  5. PreventDuplicateHandlingMode preventDuplicateHandlingMode = PreventDuplicateHandlingMode.reorderRoutes,
  6. Iterable<GetPage> pickPagesForRootNavigator(
    1. RouteDecoder currentNavStack
    )?,
  7. String? restorationScopeId,
  8. bool showHashOnUrl = false,
  9. GlobalKey<NavigatorState>? navigatorKey,
  10. required List<GetPage> pages,
})

Implementation

GetDelegate({
  GetPage? notFoundRoute,
  this.navigatorObservers,
  this.transitionDelegate,
  this.backButtonPopMode = PopMode.history,
  this.preventDuplicateHandlingMode =
      PreventDuplicateHandlingMode.reorderRoutes,
  this.pickPagesForRootNavigator,
  this.restorationScopeId,
  bool showHashOnUrl = false,
  GlobalKey<NavigatorState>? navigatorKey,
  required List<GetPage> pages,
})  : navigatorKey = navigatorKey ?? GlobalKey<NavigatorState>(),
      notFoundRoute = notFoundRoute ??= GetPage(
        name: '/404',
        page: () => const Scaffold(
          body: Center(child: Text('Route not found')),
        ),
      ) {
  if (!showHashOnUrl && GetPlatform.isWeb) setUrlStrategy();
  addPages(pages);
  addPage(notFoundRoute);
  Get.log('GetDelegate is created !');
}