OptionalExtractable<T> class final

Turns a client-error rejection into None.

Wrap any extractor with this to let a handler declare Option<T> and treat a missing or malformed value as absent.

A 5xx rejection passes through instead. Those mean something on the server is wrong, such as middleware that never wrote the context value being read, and hiding them would make a broken deployment look like an anonymous request.

const viewer = OptionalExtractable(BearerAuth());
Implemented types

Constructors

OptionalExtractable(FromRequestParts<T> inner)
Wraps inner.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
inner FromRequestParts<T>
The extractor whose client-error rejection is swallowed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

extract(Request request) Future<Result<Option<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
toString() String
A string representation of this object.
inherited

Operators

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