UiRouter constructor

UiRouter({
  1. Path rootPath = '/',
  2. required Map<Path, UiPage> pages,
  3. Map<Path, UiDialog> dialogs = const {},
})

Constructor

Implementation

UiRouter({
  this.rootPath = '/',
  required this.pages,
  this.dialogs = const {},
}) : state = (() {
        // init state
        var rootRoute = realPathToRoute(
          rootPath,
          pages.keys.toList(),
          false,
        );
        rootRoute ??= realPathToRoute(
          pages.keys.first,
          [pages.keys.first],
          false,
        )!;
        return ValueNotifier(
          UiRouterState(
            pageRoutes: [rootRoute],
            dialogRoutes: [],
            tasks: [],
          ),
        );
      })();