Skip to content

Register Multiple Singletons At Once #294

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

Closed
1AhmedYasser opened this issue Sep 30, 2022 · 2 comments
Closed

Register Multiple Singletons At Once #294

1AhmedYasser opened this issue Sep 30, 2022 · 2 comments

Comments

@1AhmedYasser
Copy link

When I setup up my singletons I do them as follows

GetIt locator = GetIt.instance;
locator.registerSingleton(Service1());
locator.registerSingleton(Service2());
locator.registerSingleton(Service3());
locator.registerSingleton(Service4());
locator.registerSingleton(Service5());

As the services grows in the app, registering them like this will become an overhead
Is there a way to register all of them at once ?

@sunderee
Copy link

You can use a code generation package like injectable. It will auto-generate registrations of your singletons/factories + it has some advanced use cases.

@1AhmedYasser
Copy link
Author

Thank you so much

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

No branches or pull requests

2 participants