addKeyedSingletonInstance<TService> method

ServiceCollection addKeyedSingletonInstance<TService>(
  1. Object? serviceKey,
  2. Object implementationInstance
)

Adds a keyed singleton service of the type specified in TService with an instance specified in implementationInstance to the specified ServiceCollection.

Implementation

ServiceCollection addKeyedSingletonInstance<TService>(
  Object? serviceKey,
  Object implementationInstance,
) {
  final descriptor = ServiceDescriptor.keyedSingletonInstance<TService>(
    serviceKey,
    implementationInstance,
  );
  add(descriptor);
  return this;
}