path property
The path (relative or absolute) or this VRouteElement
If the path of a subroute is exactly matched, this will be used in
the route but might be covered by another VRouteElement._rootVRouter
The value of the path ca have three form:
* starting with '/': The path will be treated as a route path,
this is useful to take full advantage of nested routes while
conserving the freedom of path naming
* not starting with '/': The path corresponding to this route
will be the path of the parent route + this path. If this is used
directly in the VRouter routes, a '/' will be added anyway
* be null: In this case this path will match the parent path
Note we use the package path_to_regexp
so you can use naming such as /user/:id to get the id (see VRouteElementData.pathParameters
You can also use more advance technique using regexp directly in your path, for example
'*' will match any route, '/user/:id(\d+)' will match any route starting with user
and followed by a digit. Here is a recap:
| pattern | matched path | VRouter.pathParameters
| /user/:username | /user/evan | { username: 'evan' }
| /user/:id(\d+) | /user/123 | { id: '123' }
| * | every path | -
Implementation
final String? path;