extract method

  1. @override
Future<Result<T, Rejection>> extract(
  1. Request request
)
override

Produces the value, or the rejection that stops the handler.

Implementation

@override
Future<Result<T, Rejection>> extract(Request request) async {
  final carried = request.context[extensionKeyFor<T>()];
  if (carried is T) return Ok(carried);

  return Err(
    Rejection.internal(
      'no $T in the request; add fromExtractor(...) where these routes are '
      'mounted',
    ),
  );
}