put<T> static method

T put<T>(
  1. T dependency, {
  2. String? tag,
})

Inserts a singleton instance of a class into the dependency store.

The dependency parameter is the singleton instance to be inserted.

Returns the inserted singleton instance.

Implementation

static T put<T>(T dependency, {String? tag}) {
  final key = _getKey(dependency.runtimeType, tag: tag);
  if (_dependencyStore[key] == null) {
    _dependencyStore[key] = dependency;
  }
  return _dependencyStore[key];
}