Builds a T from a request, or rejects it.
Custom extractors implement this and are named at the call site with
@Extract(MyExtractor). Configuration goes in the constructor, and a
preconfigured variant is a subclass with a zero-argument const
constructor, which is what the generated code calls.
final class BearerAuth implements FromRequestParts<AuthUser> {
const BearerAuth({this.scope});
final String? scope;
@override
Future<Result<AuthUser, Rejection>> extract(Request request) async { ... }
}
final class TodosWrite extends BearerAuth {
const TodosWrite() : super(scope: 'todos:write');
}
- Implementers
- ApiKeyExtractable
- BasicCredentialsExtractable
- BearerTokenExtractable
- ContextExtractable
- CookieExtractable
- CookieJarExtractable
- Extension
- FallibleExtractable
- FirstOf
- FromRequest
- HeaderExtractable
- HeaderMapExtractable
- HostExtractable
- OptionalExtractable
- PathExtractable
- PeerExtractable
- QueriesExtractable
- QueryExtractable
- QueryListExtractable
- RawQueryExtractable
- SessionIdExtractable
- StateExtractable
- ValidatedExtractable
- Available extensions
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
-
extract(
Request request) → Future< Result< T, Rejection> > - Produces the value, or the rejection that stops the handler.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
require(
Request request) → Future< T> -
Available on FromRequestParts<
Extracts the value, throwing the Rejection when extraction fails.T> , provided by the RequireExtraction extension -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited