registerRequestScoped<T extends Object> abstract method

void registerRequestScoped<T extends Object>(
  1. T factory()
)

Registers a dependency built once per request and shared for the rest of it.

Unlike registerFactory, which builds a new instance at every resolution, everything resolving T within one request gets the same instance — so a unit of work, a transaction, or the identity of the caller can be threaded through middleware, guards and the handler without passing it by hand.

Unlike registerSingleton, nothing is shared between requests.

If the instance implements Disposable it is disposed when the request ends. Resolving T outside a request throws.

Implementation

void registerRequestScoped<T extends Object>(T Function() factory);