FromRequestParts<T> class abstract interface

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
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<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