GetNavigator.onGenerateRoute constructor

GetNavigator.onGenerateRoute({
  1. required List<GetPage> pages,
  2. GlobalKey<NavigatorState>? key,
  3. PopPageCallback? onPopPage,
  4. List<NavigatorObserver>? observers,
  5. bool reportsRouteUpdateToEngine = false,
  6. TransitionDelegate? transitionDelegate,
  7. String? initialRoute,
  8. String? restorationScopeId,
})

Implementation

GetNavigator.onGenerateRoute({
  required List<GetPage> super.pages,
  GlobalKey<NavigatorState>? super.key,
  super.onPopPage,
  List<NavigatorObserver>? observers,
  super.reportsRouteUpdateToEngine,
  TransitionDelegate? transitionDelegate,
  super.initialRoute,
  super.restorationScopeId,
}) : super(
        onGenerateRoute: (RouteSettings settings) {
          final Iterable<GetPage> selectedPageList =
              pages.where((GetPage element) => element.name == settings.name);
          if (selectedPageList.isNotEmpty) {
            final GetPage selectedPage = selectedPageList.first;
            return GetPageRoute(
              page: selectedPage.page,
              settings: settings,
            );
          }
          return null;
        },
        observers: <NavigatorObserver>[
          ...?observers,
        ],
        transitionDelegate:
            transitionDelegate ?? const DefaultTransitionDelegate<dynamic>(),
      );