Closed davidsdearaujo closed 1 year ago
It creates a way to add and get binds by a String key.
Now all the add and get methods have a String? key parameter.
String? key
Search functions: When [key] is provided it will search the instance that have the same key Add functions: When [key] is provided this instance only can be found by key
Search functions: When [key] is provided it will search the instance that have the same key
Add functions: When [key] is provided this instance only can be found by key
T get<T>({ParamTransform? transform, String? key}); T call<T>({ParamTransform? transform, String? key}); void add<T>(Function constructor, {BindConfig<T>? config, String? key}); void addInstance<T>(T instance, {BindConfig<T>? config, String? key}); void addSingleton<T>(Function constructor, { BindConfig<T>? config, String? key}); void addLazySingleton<T>(Function constructor, {BindConfig<T>? config, String? key}); dynamic getNotifier<T>({String? key}); T? tryGet<T>({ParamTransform? transform, String? key}); bool isAdded<T>({String? key}); bool isInstantiateSingleton<T>({String? key}); T? disposeSingleton<T>({String? key}); void replaceInstance<T>(T instance, {String? key});
LGTM
@jacobaraujo7 Can you add some tests about this case?
The entire test/src/auto_injector_with_key_test.dart is testing it!
What does this PR do
It creates a way to add and get binds by a String key.
Now all the add and get methods have a
String? key
parameter.Changed Functions: