scoped<T> method

void scoped<T>(
  1. T factory(
    1. Container
    ), {
  2. String? name,
})

Registers a factory that will be executed once per container scope (e.g. per request).

Implementation

void scoped<T>(T Function(Container) factory, {String? name}) =>
  _scopedFactories[_key<T>(name)] = factory;