get_it
get_it copied to clipboard
`ignoreReferenceCount` parameter in unregister method is not used
In the unregister method, there is a parameter ignoreReferenceCount which is defined but not used in the implementation.
Current implementation:
if (factoryToRemove._referenceCount > 0) {
factoryToRemove._referenceCount--;
return;
}
The ignoreReferenceCount parameter should be used to control whether to ignore the reference count when unregistering. I suggest modifying the code to:
if (!ignoreReferenceCount && factoryToRemove._referenceCount > 0) {
factoryToRemove._referenceCount--;
return;
}
This would make the parameter work as expected:
- When
ignoreReferenceCount = false(default): keep current behavior - When
ignoreReferenceCount = true: it will ignore the reference count and unregister the object