provideValue<T> method

void provideValue<T>(
  1. T value
)

Registers an existing instance value for type T.

Directly binds value without evaluating a factory. All subsequent resolutions for T will return this exact instance.

container.provideValue<AppConfig>(AppConfig(env: 'production'));

Implementation

void provideValue<T>(T value) {
  _bindings[T] = _Binding<T>.value(value);
}