WinterRouter constructor
WinterRouter({
- List<
Route> ? routes, - RouterConfig? config,
- String basePath = '',
Implementation
factory WinterRouter({
List<Route>? routes,
RouterConfig? config,
String basePath = '',
}) {
List<Route> nonNullRoutes = [];
RouterConfig nonNullConfig = config ?? RouterConfig();
for (var route in (routes ?? [])) {
if (isValidUri(route.path)) {
nonNullRoutes.add(route);
} else {
nonNullConfig.onInvalidUrl(route);
}
}
nonNullConfig.onLoadedRoutes(nonNullRoutes);
return WinterRouter.build(
config: nonNullConfig,
routes: nonNullRoutes,
basePath: basePath,
);
}