registerForRoute method

void registerForRoute(
  1. String routeName,
  2. List<Type> controllerTypes, {
  3. ZenScope? scope,
})

Register controllers for a specific route

Controllers will be automatically disposed when the route is popped or removed.

Example:

routeObserver.registerForRoute(
  '/home',
  [HomeController, NavController],
  scope: myScope,
);

Implementation

void registerForRoute(String routeName, List<Type> controllerTypes,
    {ZenScope? scope}) {
  _routeControllers[routeName] = controllerTypes;

  if (scope != null) {
    _routeScopes[routeName] = scope;
  }

  // Changed from logDebug to logInfo - important configuration event
  ZenLogger.logInfo(
      'Registered ${controllerTypes.length} controllers for route $routeName${scope != null ? ' in scope ${scope.name ?? scope.id}' : ''}');
}