registerSingleton<T> static method

void registerSingleton<T>(
  1. T factory()
)

Registers a singleton instance of type T, meaning the same instance is used each time get<T>() is called.

Implementation

static void registerSingleton<T>(T Function() factory) {
  _instances.putIfAbsent(T, () => factory());
}