getRouterBuilderBySettings method

Widget? getRouterBuilderBySettings(
  1. BuildContext context,
  2. String pageName,
  3. RouteSettings settings
)

Gets the appropriate widget for a specific route within a named controller.

This method looks up a named controller and attempts to find a matching route handler within that controller's registered routes.

context The BuildContext to be passed to the route builder. pageName The name of the controller to look up. settings The route settings containing the path to match.

Returns a Widget if the controller and route are found, null otherwise.

Implementation

Widget? getRouterBuilderBySettings(BuildContext context, String pageName, RouteSettings settings) {
  _ControllerInstance? instance = _controllersByName[pageName];
  if (instance == null) return null;
  SubViewBuilder? builder = instance.controller.routes?[settings.name];
  if (builder == null) return null;
  return builder(context, instance.controller);
}