ValidatedExtractable<T extends Validatable> class final

Runs the Validate() constraints after inner builds the value.

Decoding and validating are separate failures that deserve separate messages: a body of the wrong shape never reaches the constraints, and a body of the right shape with a bad value never looks like a parse error. Both land on 422, so a client sees one error format either way.

const createTodo = ValidatedExtractable(
  JsonExtractable<CreateTodo>(CreateTodo.deserialize),
);

Wrapping a body extractor keeps the body extractor's rules, which readsRequestBody reports through the wrapper.

Implemented types

Constructors

ValidatedExtractable(FromRequestParts<T> inner)
Validates whatever inner produces.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
inner FromRequestParts<T>
The extractor that builds the value.
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
toString() String
A string representation of this object.
inherited

Operators

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