PathExtractable<T> class final

Extracts one router-captured path parameter, coerced to T.

@Path() String id lowers to const PathExtractable<String>('id'); the key defaults to the Dart parameter name and @Path('todo_id') overrides it.

The matcher captures the raw segment, so decoding happens here: /files/a%20b gives a b, not a%20b.

The value arrives percent-decoded, so it can contain a slash, a NUL, or any other character a client chose to encode: /files/a%2Fb matches one segment and yields a/b. That is what the value is, per RFC 3986. Treat it as untrusted text — never as a path fragment — or constrain it at the route with {name|pattern}, which refuses before a handler runs.

Implemented types
Available extensions

Constructors

PathExtractable(String key)
Reads the path parameter named key.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
key String
The path parameter name, matching a {key} segment in the route.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

extract(Request request) Future<Result<T, Rejection>>
Produces the value, or the rejection that stops the handler.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
require(Request request) Future<T>

Available on FromRequestParts<T>, provided by the RequireExtraction extension

Extracts the value, throwing the Rejection when extraction fails.
toString() String
A string representation of this object.
inherited

Operators

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