HRouter constructor

HRouter({
  1. String? basePath,
  2. List<HRoute> routes = const [],
  3. RouterConfig? config,
})

Implementation

factory HRouter({
  String? basePath,
  List<HRoute> routes = const [],
  RouterConfig? config,
}) {
  String nonNullBasePath = basePath ?? '';
  RouterConfig nonNullConfig = config ?? RouterConfig();
  HRouter router = HRouter._(
    config: nonNullConfig,
    routes: _flattenRoutes(routes, nonNullBasePath, nonNullConfig),
    basePath: nonNullBasePath,
  );

  nonNullConfig.onLoadedRoutes(router.routes);

  return router;
}