Route.fromInfo constructor
Route.fromInfo(
- HttpMethod info,
- RouteHandler handler, {
- List<
RouteInterceptor> ? after, - List<
RouteInterceptor> ? before, - List<
ExceptionHandler> ? onException,
Implementation
Route.fromInfo(this.info, this.handler,
{List<RouteInterceptor>? after,
List<RouteInterceptor>? before,
List<ExceptionHandler>? onException})
: pathSegments = pathToSegments(info.path),
_before = before ?? [],
_after = after ?? [],
_onException = onException ?? [] {
for (int i = 0; i < pathSegments.length; i++) {
String seg = pathSegments.elementAt(i);
if (seg.startsWith(':')) {
if (i == pathSegments.length - 1 && seg.endsWith('*')) {
_pathGlobVarMapping = i;
_pathGlobVarName = seg.substring(1, seg.length - 1);
} else {
seg = seg.substring(1);
if (seg.isNotEmpty) _pathVarMapping[seg] = i;
}
}
}
}