GetDelegate constructor
GetDelegate({
- GetPage? notFoundRoute,
- TransitionDelegate? transitionDelegate,
- PopMode backButtonPopMode = PopMode.history,
- PreventDuplicateHandlingMode preventDuplicateHandlingMode = PreventDuplicateHandlingMode.reorderRoutes,
- String? restorationScopeId,
- bool showHashOnUrl = false,
- 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 && !_urlStrategyApplied) {
_urlStrategyApplied = true;
try {
setUrlStrategy();
} catch (e) {
// Setting the strategy is best-effort: the web engine forbids it
// once the app has been initialized (or when the application set
// one itself before runApp), which must not break navigation.
Get.log('Could not set the URL strategy: $e', isError: true);
}
}
addPages(pages);
addPage(notFoundRoute);
Get.log('GetDelegate is created !');
}