New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unregister<T>
unregisters all services of type T
#358
Comments
@spydon can you please provide implementation of i am unable to run code which you have posted. please post compilable code. i will try to look into this. |
@venkata-reddy-dev ah sorry, missed that one, added now! |
It's probably this PR that caused the regression: #354 |
Hi Lukas,
Sorry for the inconvenience. This was for sure not intended.
Will look into it as soon as possible
Cheers
Thomas
Am 10. Apr. 2024, 17:04 +0200 schrieb Lukas Klingsbo ***@***.***>:
… Fairly certain that it's this PR that caused the regression: #354
Might have been intentional, but weird to only do a patch bump for a breaking change.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
No problem @escamoteur |
could you both have a look at FutureOr unregister<T extends Object>({
Object? instance,
String? instanceName,
FutureOr Function(T)? disposingFunction,
}) async {
final factoryToRemove = instance != null
? _findFactoryByInstance(instance)
: _findFactoryByNameAndType<T>(instanceName);
throwIf(
factoryToRemove.objectsWaiting.isNotEmpty,
StateError(
'There are still other objects waiting for this instance so signal ready',
),
);
final typeRegistration = factoryToRemove.registeredIn;
if (instanceName != null) {
typeRegistration.namedFactories.remove(instanceName);
} else {
typeRegistration.factories.remove(factoryToRemove);
}
if (typeRegistration.isEmpty) {
factoryToRemove.registrationScope.typeRegistrations.remove(T);
} I think this should be the correct implementation |
@spydon just wondering, why are you using constructor tear offs there? or better why wrapping the get_it function at all? |
There are no constructor tear-offs in the code I posted as far as I can see? I don't know what the reason for wrapping get_it was, maybe due to some testing requirements or such, the ubuntu_service package was developed a long time before my contract with canonical started. Edit: Aah, the |
should be fixed in 7.6.9 |
In get_it 7.6.8
unregister<T>
unregisters all services of typeT
, even if they have been registered with an id, this was not the case in 7.6.7.Reproduction:
The result is:
The text was updated successfully, but these errors were encountered: