getContext

T? getContext<T>(

  1. Request req,
  2. String key
)

Gets a value from the request context.

Implementation

T? getContext<T>(Request req, String key) => switch (req[_contextKey]) {
  final JSObject ctxObj => switch (ctxObj[key]?.dartify()) {
    final T v => v,
    _ => null,
  },
  _ => null,
};