createScope method

Scope createScope(
  1. String scopeId,
  2. Qualifier qualifier, {
  3. dynamic source,
})

Implementation

Scope createScope(String scopeId, Qualifier qualifier, {dynamic source}) {
  if (_scopes.containsKey(scopeId)) {
    throw Exception("Scope with id '$scopeId' is already created");
  }

  ScopeDefinition? scopeDefinition = scopeDefinitions[qualifier];
  if (scopeDefinition != null) {
    Scope createdScope =
        createScopeByDefinition(scopeId, scopeDefinition, source: source);
    _scopes[scopeId] = createdScope;
    return createdScope;
  } else {
    throw Exception(
        'No Scope Definition found for qualifer \'$qualifier\'');
  }
}