Skip to content

Fix unregister bug when no disposing function provided #21

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

Merged
merged 1 commit into from
Sep 24, 2019
Merged

Fix unregister bug when no disposing function provided #21

merged 1 commit into from
Sep 24, 2019

Conversation

ewertonrp
Copy link
Contributor

@ewertonrp ewertonrp commented Sep 12, 2019

When call unregister with no disposing function, then call of disposingFunction is not checked, throwing NoSuchMethodError: The method 'call' was called on null.

Steps to reproduce:

GetIt.I.registerSingleton("Value");
try {
  GetIt.I.unregister<String>();
} catch (ex) {
  print(ex); // NoSuchMethodError: The method 'call' was called on null.
}

When call unregister with no disposing function, then call of disposingFunction is not checked, throwing NoSuchMethodError: The method 'call' was called on null.

Steps to reproduce:

GetIt.I.registerSingleton("Value");
try {
  GetIt.I.unregister<String>();
} catch (ex) {
  print(ex); // NoSuchMethodError: The method 'call' was called on null.
}
Copy link
Collaborator

@escamoteur escamoteur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, looks good could you add a test for that case too?

@ewertonrp
Copy link
Contributor Author

Hi, looks good could you add a test for that case too?

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants