DBRouterDelegate constructor

  1. required DBPage initialPage,
  2. required List<DBPageBuilder> pageBuilders,
  3. GlobalKey<NavigatorState>? navigatorKey,
  4. List<NavigatorObserver>? navigatorObservers,
  5. @visibleForTesting Map<String, Completer<Object?>>? popResultTracker,
  6. String? restorationScopeId,
  7. bool reportPageUpdateToEngine = false,

Create a DBRouterDelegate with the provided pageBuilders and initialPage.

pageBuilders the list DBPageBuilder that will be used to build route requested by client of this DBRouterDelegate.

If none of the pageBuilders in this list can't create the page requested a PageNotFoundException will be thrown.

initialPage that will be displayed by the DBRouterDelegate.

navigatorKey Key for the Navigator's state, allowing to have the same state on different build and that can be used to access the navigator created by this delegate.

popResultTracker A Map that track pop result of page pushed into the stack.


factory DBRouterDelegate({
  required DBPage initialPage,
  required List<DBPageBuilder> pageBuilders,
  GlobalKey<NavigatorState>? navigatorKey,
  List<NavigatorObserver>? navigatorObservers,
  @visibleForTesting Map<String, Completer<Object?>>? popResultTracker,
  String? restorationScopeId,
  bool reportPageUpdateToEngine = false,
}) {
  assert(pageBuilders.isNotEmpty, 'Page builder list is empty');
      (DBPageBuilder builder) {
        return builder.supportRoute(initialPage.destination);
    'no page builder in [pageBuilders] list can build initialPage',

  return DBRouterDelegate.private(
    navigatorKey ?? GlobalKey<NavigatorState>(),
    popResultTracker ?? <String, Completer<Object?>>{},
    navigatorObservers ?? <NavigatorObserver>[],
    reportPageUpdateToEngine: reportPageUpdateToEngine,