void register()

in lib/service_scope.dart [169:186]


  void register(Object serviceScopeKey, Object value,
      {ScopeExitCallback? onScopeExit}) {
    _ensureNotInCleaningState();
    _ensureNotInDestroyingState();

    var isParentCopy = _parentCopies.contains(serviceScopeKey);
    if (!isParentCopy && _key2Values.containsKey(serviceScopeKey)) {
      throw ArgumentError(
          'Service scope already contains key $serviceScopeKey.');
    }

    var entry = _RegisteredEntry(serviceScopeKey, value, onScopeExit);

    _key2Values[serviceScopeKey] = entry;
    if (isParentCopy) _parentCopies.remove(serviceScopeKey);

    _registeredEntries.add(entry);
  }