configureRoutes method

  1. @Deprecated('Use configureRoutesAsync — will be removed in 5.0')
List<RouteBase> configureRoutes({
  1. String modulePath = '',
  2. bool topLevel = false,
  3. String? parentModuleName,
  4. String? parentModulePath,
  5. String parentRoutePath = '',
})

Synchronous route configuration entry point.

Walks the module tree and produces the flattened list of RouteBase consumed by GoRouter.

Migration: prefer configureRoutesAsync for new modules — it allows awaiting async setup (feature flags, remote config, lazy module loading) before route construction. This method will be removed in 5.0.

Implementation

@Deprecated('Use configureRoutesAsync — will be removed in 5.0')
List<RouteBase> configureRoutes({
  String modulePath = '',
  bool topLevel = false,
  String? parentModuleName,
  String? parentModulePath,
  String parentRoutePath = '',
}) {
  return [
    ..._createChildRoutes(
      routeList: null,
      topLevel: topLevel,
      parentModuleName: parentModuleName,
      parentModulePath: parentModulePath,
      parentRoutePath: parentRoutePath,
    ),
    ..._createModuleRoutes(
      routeList: null,
      modulePath: modulePath,
      topLevel: topLevel,
      grandParentModuleName: parentModuleName,
      grandParentModulePath: parentModulePath,
    ),
    ..._createShellRoutes(topLevel),
  ];
}