Skip to content
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

How to bind an implementation to MULTIPLE abstract classes ? #470

Open
quyen1102 opened this issue Jun 7, 2024 · 1 comment
Open

How to bind an implementation to MULTIPLE abstract classes ? #470

quyen1102 opened this issue Jun 7, 2024 · 1 comment

Comments

@quyen1102
Copy link

code

@quyen1102 quyen1102 changed the title How to bind MULTIPLE abstract classes to an implementation? How to bind an implementation to MULTIPLE abstract classes ? Jun 7, 2024
@pedrosantosdd
Copy link

Don't know if this is what you are needing, but you can achieve this using an abstract class with @module notation
eg:

@module
abstract class MyModule {
    @injectable
    IClass1 get iClass1 => GetIt.I.get<ClassA>();
    @injectable
    IClass2 get iClass2 => GetIt.I.get<ClassA>();
    @injectable
    IClass3 get iClass3 => GetIt.I.get<ClassA>();
}

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