build method

Widget build(
  1. BuildContext context,
  2. RouteMatchList matchList,
  3. bool routerNeglect
)

Builds the top-level Navigator for the given RouteMatchList.

Implementation

Widget build(
  BuildContext context,
  RouteMatchList matchList,
  bool routerNeglect,
) {
  if (matchList.isEmpty && !matchList.isError) {
    // The build method can be called before async redirect finishes. Build a
    // empty box until then.
    return const SizedBox.shrink();
  }
  assert(matchList.isError || !matchList.last.route.redirectOnly);
  return builderWithNav(
    context,
    _CustomNavigator(
      navigatorKey: configuration.navigatorKey,
      observers: observers,
      navigatorRestorationId: restorationScopeId,
      onPopPageWithRouteMatch: onPopPageWithRouteMatch,
      matchList: matchList,
      matches: matchList.matches,
      configuration: configuration,
      errorBuilder: errorBuilder,
      errorPageBuilder: errorPageBuilder,
    ),
  );
}