Skip to content

Commit

Permalink
Fix popScopesTill
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhnroyal committed Oct 23, 2024
1 parent 5d28db4 commit 4f14690
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/get_it_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1474,18 +1474,21 @@ class _GetItImplementation implements GetIt {
}
String? poppedScopeName;
_Scope nextScopeToPop = _currentScope;
do {
bool somethingWasPopped = false;

while (nextScopeToPop.name != _baseScopeName &&
hasScope(scopeName) &&
(nextScopeToPop.name != scopeName || inclusive)) {
poppedScopeName = nextScopeToPop.name;
await dropScope(poppedScopeName!);
somethingWasPopped = true;
nextScopeToPop = _scopes.lastWhere((x) => x.isPopping == false);
if (nextScopeToPop.name == _baseScopeName) {
return true;
}
} while (hasScope(scopeName) && inclusive
? (poppedScopeName != scopeName)
: (nextScopeToPop.name != scopeName));
onScopeChanged?.call(false);
return true;
}

if (somethingWasPopped) {
onScopeChanged?.call(false);
}
return somethingWasPopped;
}

/// Disposes all registered factories and singletons in the provided scope
Expand Down

0 comments on commit 4f14690

Please sign in to comment.