PathVariableResolver class final

Resolves method parameters annotated with PathVariable by extracting values from URI template variables.

This resolver accesses path variables that were extracted from the request URI during routing. Path variables are typically defined in request mapping patterns like /users/{id}.

Resolution Process

  1. Looks up the path variable by name in the request's path variable map
  2. Returns the path variable value if found
  3. Handles required validation and default values

Example

For a URI like /users/123 with mapping /users/{id} and annotation @PathVariable('id'), this resolver would return "123".

Error Handling

Throws InvalidArgumentException when a required path variable is missing and no default value is provided.

Thread Safety

This resolver is stateless and thread-safe.

Implemented types

Constructors

PathVariableResolver()
Resolves method parameters annotated with PathVariable by extracting values from URI template variables.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(ServerHttpRequest request, Parameter parameter, ResolverContext context) Future<Object?>
Resolves the actual value for the method parameter from the current HTTP request.
override
supports(Parameter parameter) bool
Determines whether this resolver can handle the specified method parameter.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited