jonsamwell / flutter_simple_dependency_injection

A super simple dependency injection implementation for flutter that behaviours like any normal IOC container and does not rely on mirrors
MIT License
94 stars 8 forks source link

Unregister or Overriding ? #13

Closed rafaelcorbellini-egsys closed 4 years ago

rafaelcorbellini-egsys commented 4 years ago

Is there any attempt to unregister something registered? or some way to override something already registered (mapped).

example on Kiwi: https://pub.dev/packages/kiwi#unregistering

jonsamwell commented 4 years ago

Hi @rafaelcorbellini-egsys, thanks for the suggestion. I have added a way to remove a mapping or all mappings for a type. This is available in version 1.0.3 https://pub.dev/packages/flutter_simple_dependency_injection/versions/1.0.3

  injector.removeMapping<SomeType>();

  injector.removeMapping<SomeType>(key: 'some_key');

  injector.removeAllMappings<SomeType>();