Skip to content

feature(unregister): fixes some appointments from PR #15 #17

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 2 commits into from
Sep 4, 2019
Merged

Conversation

jhionan
Copy link
Contributor

@jhionan jhionan commented Sep 3, 2019

Removed adicional map.remove on wrong place, changed optional named parameters to optional positional and renaming disposal function to disposingFunction

…name, and also dispose resources in the process

Signed-off-by: Jhionan <[email protected]>
…nge named parameters for positional renaming second parameter from disposal to disposingFunction

Signed-off-by: Jhionan <[email protected]>
lib/get_it.dart Outdated
/// if you need to dispose any resources you can do it using [disposal] function
/// that provides a instance of your class to be disposed
void unregister<T>({String instanceName, Function(T) disposal}) {
assert(_factoriesByName.containsKey(instanceName) || _factories.containsKey(T), 'Nor Type ${T.toString()} or instance Name must not be null');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, my fault, I missed that you passed named parameters. I will merge and change that back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice. I start updating readme and just realize that optional positional parameters is a bad idea in this case, because if you want to remove a typed instance and use the dispose function you would use something like unregister<T>( _ , function);

@escamoteur
Copy link
Collaborator

Could you also update the readme after I merged?

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