singleton<T> method

  1. @override
void singleton<T>(
  1. dynamic factory(
    1. ContainerInterface
    )
)
override

Registers a singleton instance.

Creates a binding that will cache the first created instance and return it for all subsequent resolutions.

T - The type to register as singleton factory - Factory function that creates the instance

Implementation

@override
void singleton<T>(dynamic Function(ContainerInterface) factory) {
  bind<T>(factory, singleton: true);
}