toCompletedBrowserRoute method

Future<BrowserRoute> toCompletedBrowserRoute()

Converts this DeferredBrowserRoute into a BrowserRoute with its deferred content already loaded.

This method performs the asynchronous loading operations (_loadPageLibrary and _initializeServiceLocator) and then returns a new BrowserRoute instance that directly displays the final widget, bypassing the loading state. This is useful when the deferred content has been preloaded or loaded by another mechanism.

Implementation

Future<BrowserRoute> toCompletedBrowserRoute() async {
  await _loadDeferred(
    loadPageLibrary: _loadPageLibrary,
    initializeServiceLocator: _initializeServiceLocator,
  );

  return BrowserRoute(
    path: path,
    page: _page,
    builderTrigger: builderTrigger,
    validateArguments: validateArguments,
    routeTransition: routeTransition,
  );
}