UiRouter constructor

UiRouter({
  1. required List<UiRoute> pages,
  2. List<UiDialog> dialogs = const [],
  3. String? redirect(
    1. UiState state
    )?,
})

Implementation

factory UiRouter({
  // Pages
  required List<UiRoute> pages,
  // Dialogs
  List<UiDialog> dialogs = const [],
  // Redirect returns URI
  String? Function(UiState state)? redirect,
}) {
  final rootShell = UiShell.root(
    pages: pages,
  );
  final theme = themeFromRoute(rootShell) as UiNavShellTheme;
  final dialogNotifier = UiDialogNotifier(
    dialogs: dialogs,
  );
  final navShellNotifiers = createAllNavNotifiers(rootShell, redirect);
  final tabShellNotifiers = createAllTabNotifiers(rootShell, redirect);
  return UiRouter._(
    shellPath: rootShell.path,
    rootTheme: theme,
    navShellNotifiers: navShellNotifiers,
    tabShellNotifiers: tabShellNotifiers,
    dialogNotifier: dialogNotifier,
  );
}