getOrCreateInstance method

  1. @override
T? getOrCreateInstance({
  1. required String scopeId,
  2. required String scopeName,
})
override

Implementation

@override
T? getOrCreateInstance({required final String scopeId, required final String scopeName}) {
  if (scopeId == SingletonScope.scopeId) return null;
  if (scopeName != _scopeName) return null;

  var sharedInstance = _sharedInstanceMap[scopeId];
  if (sharedInstance == null) {
    sharedInstance = createInstance();
    _sharedInstanceMap[scopeId] = sharedInstance;
  }
  return sharedInstance;
}