tryAddTransient<TService> method

void tryAddTransient<TService>(
  1. ImplementationFactory implementationFactory
)

Adds the specified TService as a ServiceLifetime.transient service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

Implementation

void tryAddTransient<TService>(
  ImplementationFactory implementationFactory,
) {
  final descriptor = ServiceDescriptor.transient<TService>(
    implementationFactory,
  );
  tryAdd(descriptor);
}