createScope method
Creates a new child scope.
The child scope can register its own dependencies or shadow dependencies from this parent scope.
name is used for debugging.
Implementation
LevitScope createScope(String name) {
_ensureUsable();
assert(() {
LevitScope? current = this;
while (current != null) {
if (current.name == name) {
_emitScopeDebugWarning(
'LevitScope: Child scope "$name" has the same name as ancestor '
'scope "${current.name}" (id: ${current.id}). '
'Consider unique names for debugging clarity.',
);
break;
}
current = current._parentScope;
}
return true;
}());
return LevitScope._(name, parentScope: this);
}