registerSingleton<T extends Object> abstract method

void registerSingleton<T extends Object>(
  1. T factoryFunction(
    1. GetIt
    ), {
  2. String? instanceName,
})

Registers a new singleton object

This method takes a single argument, factoryFunction, which is a function that returns an instance of the type T.

It also takes an optional argument, instanceName, which is the name of the instance to be registered.

factoryFunction is a function that returns an instance of the type T.

instanceName is the name of the instance to be registered.

If instanceName is not provided, the instance will be registered with the default name, which is the type of T.

Implementation

void registerSingleton<T extends Object>(
  T Function(GetIt) factoryFunction, {
  String? instanceName,
});