tryBuild method
Widget
tryBuild(
- BuildContext context,
- RouteMatchList matchList,
- bool routerNeglect,
- Map<
Page< registry,Object?> , GoRouterState>
Builds the top-level Navigator by invoking the build method on each matching route.
Throws a _RouteBuilderError
.
Implementation
@visibleForTesting
Widget tryBuild(
BuildContext context,
RouteMatchList matchList,
bool routerNeglect,
GlobalKey<NavigatorState> navigatorKey,
Map<Page<Object?>, GoRouterState> registry,
) {
// TODO(chunhtai): move the state from local scope to a central place.
// https://github.com/flutter/flutter/issues/126365
final _PagePopContext pagePopContext =
_PagePopContext._(onPopPageWithRouteMatch);
return builderWithNav(
context,
_buildNavigator(
pagePopContext.onPopPage,
_buildPages(context, matchList, pagePopContext, routerNeglect,
navigatorKey, registry),
navigatorKey,
observers: observers,
restorationScopeId: restorationScopeId,
requestFocus: requestFocus,
),
);
}