register<T> method

void register<T>(
  1. T instance, {
  2. String? moduleId,
  3. bool allowOverwrite = false,
})

Registers a dependency as a Singleton.

This is an alias for registerSingleton.

instance The object instance to store. moduleId Optional ID of the module that owns this registration. allowOverwrite If true, allows replacing an existing registration of the same type.

Implementation

void register<T>(
  T instance, {
  String? moduleId,
  bool allowOverwrite = false,
}) => registerSingleton<T>(
  instance,
  moduleId: moduleId,
  allowOverwrite: allowOverwrite,
);