FlowerDelegate constructor

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

Implementation

FlowerDelegate({
  FlowerPage? 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<FlowerPage> pages,
})  : navigatorKey = navigatorKey ?? GlobalKey<NavigatorState>(),
      notFoundRoute = notFoundRoute ??= FlowerPage(
        name: '/404',
        page: () => const Scaffold(
          body: Center(child: Text('Route not found')),
        ),
      ) {
  if (!showHashOnUrl && FlowerPlatform.isWeb) setUrlStrategy();
  addPages(pages);
  addPage(notFoundRoute);
  Flower.log('FlowerDelegate is created !');
}