fluttercommunity / get_it

Get It - Simple direct Service Locator that allows to decouple the interface from a concrete implementation and to access the concrete implementation from everywhere in your App. Maintainer: @escamoteur
https://pub.dev/packages/get_it
MIT License
1.36k stars 149 forks source link

popScopeUntil should allow baseScope with inclusive: false #299

Closed ccadieux closed 1 year ago

ccadieux commented 2 years ago

Thank you for adding the inclusive flag on popScopeUntil. I feel the assert needs to be updated with the new flag though. https://github.com/fluttercommunity/get_it/blob/master/lib/get_it_impl.dart#L795

This should be valid but fails due to the current assert. Since it's popping everything except the baseScope.

  await GetIt.I.popScopesTill('baseScope', inclusive: false);

Current:

assert(scopeName != _baseScopeName, "You can't pop the base scope");

Suggested

assert(inclusive && scopeName != _baseScopeName, "You can't pop the base scope");
escamoteur commented 1 year ago

Sorry for the late response, I had to take a longer break due to health issues. Thanks for this catch, will be fixed in the next release

escamoteur commented 1 year ago

fixed in V7.6.0

ccadieux commented 1 year ago

Thank you. Good to see you back!