You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I am using get_it version 5.0.1 and I have a snippet like this
final locator = GetIt.instance;
check() {
Test a = Test();
locator.registerFactory<Test>(() => a);
Test b = locator.get<Test>();
print(identical(a, b)); // true
print(locator.isRegistered<Test>(instance: b)); // false
}
As you can see, the identical returns true for instances a and b. However, when I try to check whether the instance b is registered, it returns false. If I modify the last print statement as below
print(locator.isRegistered<Test>()); // true
then it does return true. But since I want to check if exact instance is registered or not, this does not suit my needs at all. Is there something that I am missing regarding to the usecase of instance field?
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Hi. I am using get_it version 5.0.1 and I have a snippet like this
As you can see, the identical returns true for instances a and b. However, when I try to check whether the instance b is registered, it returns false. If I modify the last print statement as below
print(locator.isRegistered<Test>()); // true
then it does return true. But since I want to check if exact instance is registered or not, this does not suit my needs at all. Is there something that I am missing regarding to the usecase of instance field?
The text was updated successfully, but these errors were encountered: